From nobody Sun Nov 24 23:33:34 2024 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=1719482509; cv=none; d=zohomail.com; s=zohoarc; b=htN9vYl9E+oAD/Qj+4hfXD/TcMYNkt3Q3TIAAsSI54TPwMVnBTlvpGBrzc6mPuBB0P24Ix/EQtl879In5QrVpQr1jlO0elwB5gnlAFtmGiSGW9fX7CLWD9+lKBbmOpmeqdyjiLffQUzDXs95VDuvu/SY6BKH2y4cdE0Y+6tJTno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482509; 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=9SbOXMdD9Afo9G+k2c8nKcFprRWncVmzYgA0dcpIFRM=; b=WVhx6G5HZXLmvnKLvFWcNcuJaygH16bFZbkIv2XLV7Y7iYAumDmr73nOpieUCukI5OUOR9zw2dtqDnZYsw5RZTbSD3vLsHP0FJz26ALQVDDtjcDZZPStIDAmMeTnfNDj2SnxPKm52b9Ep7iTzP6nNjIDqyaSELeh3biTjtnl9J8= 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 1719482509722176.51945473228147; Thu, 27 Jun 2024 03:01:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwH-0004wh-3I; Thu, 27 Jun 2024 06:01:13 -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 1sMlwF-0004wT-UD for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:11 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwE-0001ZC-B3 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:11 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-7067a2e9607so3839391b3a.3 for ; Thu, 27 Jun 2024 03:01:09 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482469; x=1720087269; 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=9SbOXMdD9Afo9G+k2c8nKcFprRWncVmzYgA0dcpIFRM=; b=fl9UINKxO0NLuqqzyo8BT2fq5WyQXDQZRQdWHakguc15GULVtHUO4hCbOhFLN62IMd ZB2sl//WkbQv7ZnnK+BXlFe7i6KyVrvoKFM5KBlQ0VaVR+vvL6NO1hqN/l7bddbX7WXW a47+XXXmkyKWvqID1ScGQ2JUeWh3dTw+UEzm4nEY1lCsmmK7B4Fm4BvAW1CLUHXoazK/ lQoBjsb/A2PYCQft7JeQHaM5+Ohy6Bi4f8VDjaSE35W7klCoQZLqjhHQPm80jl8M1hu6 Ev3rC0ztXYjFLIMRhT0OsVABu6IC2kkAn291LZLpe8czZCPr7Ny3LqXux6AnkoFrL38V PMew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482469; x=1720087269; 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=9SbOXMdD9Afo9G+k2c8nKcFprRWncVmzYgA0dcpIFRM=; b=mcO+jj6sUVQOxHKV+tsCN+NBg7eD16OtwUjb4NOl3wbP/QuC5S6lkwPsV6x3WZxYpR FT+4SS/UCaKawc9ZCPfdBQRK62akJuWLuboPfQ5AujdQbwgreSS1joQMXsa2pYvkft5u D+WhIzOyeOba6pGRaewGcgZnGbruYLVMpTcUQCbKxCwCF+/GaNrB/h9vxtu2I0kESQ8Q MtJf4iewcxX+VtJFL5F2DJRNUURNekmAuPVgrNQ7aeWAN67C98dMhOp89KXz3cnpLXbd QjcSXqYZK8zjAJH2igvVct61H4sP0T9rdAafI507e6j8lj/Gay4tecMKv1Sgg1ElTNwK cRsg== X-Gm-Message-State: AOJu0YwzmGfmr29ml32dqenShQNM8eFhSemW+ESSTUrydNtVElm7VRed 8siZL0PreN0kNDVRCbTYb+4WkKEiDl+GvqZdG9GvsSXcUGB1IDRkn/EOP8pE X-Google-Smtp-Source: AGHT+IF3MUcSMi3w/Up7qCoJNqQKwduv5II7kpoB4syDjuHb27AzrelLTkCBjZsYc8HV4bQwjwBOhw== X-Received: by 2002:a05:6a00:18a3:b0:704:3a0f:1d88 with SMTP id d2e1a72fcca58-70670ffc05dmr19409067b3a.21.1719482468559; Thu, 27 Jun 2024 03:01:08 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Rajnesh Kanwal , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 01/32] target/riscv: Extend virtual irq csrs masks to be 64 bit wide. Date: Thu, 27 Jun 2024 20:00:22 +1000 Message-ID: <20240627100053.150937-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::432; envelope-from=alistair23@gmail.com; helo=mail-pf1-x432.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482511697100003 Content-Type: text/plain; charset="utf-8" From: Rajnesh Kanwal AIA extends the width of all IRQ CSRs to 64bit even in 32bit systems by adding missing half CSRs. This seems to be missed while adding support for virtual IRQs. The whole logic seems to be correct except the width of the masks. Fixes: 1697837ed9 ("target/riscv: Add M-mode virtual interrupt and IRQ filt= ering support.") Fixes: 40336d5b1d ("target/riscv: Add HS-mode virtual interrupt and IRQ fil= tering support.") Signed-off-by: Rajnesh Kanwal Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis Message-ID: <20240520125157.311503-2-rkanwal@rivosinc.com> Signed-off-by: Alistair Francis --- target/riscv/csr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 58ef7079dc..dd89edb06a 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1197,18 +1197,18 @@ static const target_ulong sstatus_v1_10_mask =3D SS= TATUS_SIE | SSTATUS_SPIE | */ =20 /* Bit STIP can be an alias of mip.STIP that's why it's writable in mvip. = */ -static const target_ulong mvip_writable_mask =3D MIP_SSIP | MIP_STIP | MIP= _SEIP | +static const uint64_t mvip_writable_mask =3D MIP_SSIP | MIP_STIP | MIP_SEI= P | LOCAL_INTERRUPTS; -static const target_ulong mvien_writable_mask =3D MIP_SSIP | MIP_SEIP | +static const uint64_t mvien_writable_mask =3D MIP_SSIP | MIP_SEIP | LOCAL_INTERRUPTS; =20 -static const target_ulong sip_writable_mask =3D SIP_SSIP | LOCAL_INTERRUPT= S; -static const target_ulong hip_writable_mask =3D MIP_VSSIP; -static const target_ulong hvip_writable_mask =3D MIP_VSSIP | MIP_VSTIP | +static const uint64_t sip_writable_mask =3D SIP_SSIP | LOCAL_INTERRUPTS; +static const uint64_t hip_writable_mask =3D MIP_VSSIP; +static const uint64_t hvip_writable_mask =3D MIP_VSSIP | MIP_VSTIP | MIP_VSEIP | LOCAL_INTERRUPTS; -static const target_ulong hvien_writable_mask =3D LOCAL_INTERRUPTS; +static const uint64_t hvien_writable_mask =3D LOCAL_INTERRUPTS; =20 -static const target_ulong vsip_writable_mask =3D MIP_VSSIP | LOCAL_INTERRU= PTS; +static const uint64_t vsip_writable_mask =3D MIP_VSSIP | LOCAL_INTERRUPTS; =20 const bool valid_vm_1_10_32[16] =3D { [VM_1_10_MBARE] =3D true, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482824; cv=none; d=zohomail.com; s=zohoarc; b=Vf0xTvq1/8kJwQP77ugjPslfARDaku5OGo4VEPu4isn2pkJFJMMLUOCjMadt7KNcBcZzXr0/6ABWFPA62iqroQsdxHVgZ5ATb00Sh3/uQFu9WNmF32Fq4Q3Gr443vulr18GO2kfVAI2Zhy0/rjpGHn9Jef+DfRLMUTfqZG1PpkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482824; 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=XHVdgQ5R0OU4he+m9ZDS4YAng1a0QCz6gz1s5XZ7cf0=; b=hROjdVG7ORNg2Nr+R3OZSpVuou5pXkOr1ZeUougWJdaosGugyvTvILuiDWtZNCYmX/Wc93vQybfiRSpj8dqpFx3Efp7MEWhYQLu3W+5Hkkz8DV3nubi3bs4TpUEnAJxUHwqLQ9RNsENIUJ5ouF50YF3z53VPhlS6gOc6ZPk0cxw= 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 1719482824161269.48134348163387; Thu, 27 Jun 2024 03:07:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwK-0004x9-JI; Thu, 27 Jun 2024 06:01:16 -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 1sMlwJ-0004x0-BI for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:16 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwH-0001ZX-I3 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:14 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-70670188420so4012391b3a.2 for ; Thu, 27 Jun 2024 03:01:13 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482472; x=1720087272; 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=XHVdgQ5R0OU4he+m9ZDS4YAng1a0QCz6gz1s5XZ7cf0=; b=lTy/a9VmlcBlFNvzWq4EmE4OzcYzzEbtpivONxSuaQJHk4SatoZ22m30uj0GR0nu+H yWrtcn9GGsD8QkIwhob8QOy1ZH0zjwDN4GAWNQdDQzMyq2+rOR6lpquRGMuzGKG1bIgA YDe5JQ2LNDA3F9ThzA/HarZnElm3FSCId57TPhGZySnn8YaKVnAzaipuU8mYL5q2D0c/ PTfdI/ceHcUNT9PK0R4+cB5y9wyyIikgknOgZB9WKIEoFifBcS6XhhHpplzK3PiZ0Qap gf34+L3k4BsQzEs6h86EnuIX9HbaIbjst0p0FfD+HWQeYx3Av7mpvSOW5DovDi/JgHkL dacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482472; x=1720087272; 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=XHVdgQ5R0OU4he+m9ZDS4YAng1a0QCz6gz1s5XZ7cf0=; b=HiD0vNRjFd+g2MYq4JWe6q0lF8ToswYbWLIBSmKIcP7PiFngoN2RiQloIbSbFGk+a0 T+ErfAYIgD9k/Savbr2lP9ejaMD2c/kUswaWtAtRtgjPitlkL+bbW44dvrHzbcDB0IAh P+HvTV6E0sI8pRbE+nm26pKVQoboAapgfqI/SivPqbD7r+gz0Gfwc/jLgsoEMor53LTr soV8WZdVcLJkKip/EFPDT2lpcj4PPZZ+FiNTX72NKj8HypgjyeJWbh15/+gpXIA9hw55 OSh8ceBuRK9xutrlw6RAlIGPAq85Cyv1pRBuTQgDMYkIqSfrHJcORd5ObBMnjtdQAlyO U+3g== X-Gm-Message-State: AOJu0YwubU/cBKO17QpZN+D7bibstaJxJikWx2rQKhaM9J9Oi37FtBgv OkmSXYZlJR5tGvLZl4PHspHb3SqDS0SphOBmeNX568WFGitAPCOrk419PF7N X-Google-Smtp-Source: AGHT+IEIjTxOTZ+8LPGC1VoXdY16gbAcuKdNKVBV//ifj0meDne7H76OnSlgkcV4ntsvAMZi4s3mXA== X-Received: by 2002:a05:6a00:9290:b0:706:636a:21e1 with SMTP id d2e1a72fcca58-7066e4e6832mr19253105b3a.6.1719482471690; Thu, 27 Jun 2024 03:01:11 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Rajnesh Kanwal , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 02/32] target/riscv: Move Guest irqs out of the core local irqs range. Date: Thu, 27 Jun 2024 20:00:23 +1000 Message-ID: <20240627100053.150937-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::42a; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482826172100003 Content-Type: text/plain; charset="utf-8" From: Rajnesh Kanwal Qemu maps IRQs 0:15 for core interrupts and 16 onward for guest interrupts which are later translated to hgiep in `riscv_cpu_set_irq()` function. With virtual IRQ support added, software now can fully use the whole local interrupt range without any actual hardware attached. This change moves the guest interrupt range after the core local interrupt range to avoid clash. Fixes: 1697837ed9 ("target/riscv: Add M-mode virtual interrupt and IRQ filt= ering support.") Fixes: 40336d5b1d ("target/riscv: Add HS-mode virtual interrupt and IRQ fil= tering support.") Signed-off-by: Rajnesh Kanwal Acked-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-ID: <20240520125157.311503-3-rkanwal@rivosinc.com> Signed-off-by: Alistair Francis --- target/riscv/cpu_bits.h | 3 ++- target/riscv/csr.c | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 74318a925c..a470fda9be 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -695,7 +695,8 @@ typedef enum RISCVException { #define IRQ_M_EXT 11 #define IRQ_S_GEXT 12 #define IRQ_PMU_OVF 13 -#define IRQ_LOCAL_MAX 16 +#define IRQ_LOCAL_MAX 64 +/* -1 is due to bit zero of hgeip and hgeie being ROZ. */ #define IRQ_LOCAL_GUEST_MAX (TARGET_LONG_BITS - 1) =20 /* mip masks */ diff --git a/target/riscv/csr.c b/target/riscv/csr.c index dd89edb06a..ee33019b03 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1145,7 +1145,14 @@ static RISCVException write_stimecmph(CPURISCVState = *env, int csrno, =20 #define VSTOPI_NUM_SRCS 5 =20 -#define LOCAL_INTERRUPTS (~0x1FFF) +/* + * All core local interrupts except the fixed ones 0:12. This macro is for + * virtual interrupts logic so please don't change this to avoid messing up + * the whole support, For reference see AIA spec: `5.3 Interrupt filtering= and + * virtual interrupts for supervisor level` and `6.3.2 Virtual interrupts = for + * VS level`. + */ +#define LOCAL_INTERRUPTS (~0x1FFFULL) =20 static const uint64_t delegable_ints =3D S_MODE_INTERRUPTS | VS_MODE_INTERRUPTS | MIP_LCOFIP; --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482567; cv=none; d=zohomail.com; s=zohoarc; b=GS82aqVuPjvX7wQcsJz6Ax4aOWIseWpTyKe3m5nV2yjDJOUZDEYv25CbksGGiSCL9BSsElsEaVas/UBP80x0v3CU/twjRKuDQ07exRGTfmI4nhqDgiZoUtlPmDpbFEtwj0xHn/WnBUS1wQPx10KkrgUYYfoyp8l9q89rgG52vc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482567; 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=5Zbww0x25XgOxnxpJhSt8HZ1tEpLVotQQz6WQupL3AI=; b=OTjuOeGWo42m9VcHj8EOURUci4NINYhS1pA2kwzX4AwhNlUNpkC5o1SvfwntW5pPEMWZVwgB6na7651JxJ94rZOTh+6VAafLKjGtkvizWNN2M0hHxS1za0SYRYb1WOryWje7zfvJNuYBc42G17znGW/2OEVDQi/Fto9CgWgfufE= 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 1719482567073363.2389894224798; Thu, 27 Jun 2024 03:02:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwY-0004yi-QP; Thu, 27 Jun 2024 06:01: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 1sMlwM-0004xV-35 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:18 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwK-0001Zl-Ae for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:17 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-706a1711ee5so1721919b3a.0 for ; Thu, 27 Jun 2024 03:01:15 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482475; x=1720087275; 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=5Zbww0x25XgOxnxpJhSt8HZ1tEpLVotQQz6WQupL3AI=; b=RdIAawFO6kq7MxyieqXywl7+cx0znbmZLI0jBYnXsxZsFAu9nE7P8gH+5XKC3CbxU9 rQhGvpUOE+TYUR9krtfYwUuhUoWXkAhbLwP5oETMpTKffR65VUbF2srGzrvDMLtiSz6K jb/YH+VqfDVCTXvxTmd9J7BZeLeGM43A6qwDCVgYBHoYMVQET2ygirznhC16P5WHjA/T E3fdL7iIwwXwpBQ7Xfxno7qQDm0WF9xcv+07LeDKQYgLsgNT5gs/3tgpRHwOpkrpeMag Helapg5tIhDGipY4bIojPBOGaUYhDHD+s91tRkEFBFQDhv/LtBiGo5gFEsSnoMBzCaiL MR+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482475; x=1720087275; 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=5Zbww0x25XgOxnxpJhSt8HZ1tEpLVotQQz6WQupL3AI=; b=H/WyJO62hjwXhYlPY6OT/aXgUFe17UzyYvZPIK6yJIQFBjYerDXjcE4xNOCpgHYZ6J 1lZan3ZZZH1eBjgirThm3F3xjrb6HiDo3zugmnApMRAxBiMElCDBszmjROoX8yLgpkNl WmaLlCcN0XkHfB638Z3Gt/wPhGwRDXD9Hcx+axInTB9itZujqeHUiThgH9mp1n56zqk5 wBp4ZHwZuuz8tGzhNX1T+3g4RDLGwxFFBR28ZVlxDHEYa0FncrwiqVlRsd+TIbDcmhiQ V6Dn6omCQjFFE/z0B5hYBDtWbYCB40U1zVOi5NvMv0bJwAbPuqSqhN9sMjt94eR8wAQ+ 4ulA== X-Gm-Message-State: AOJu0YxZ4vtuNItx1kegpx9w/i70JEYNDelB21XSupYLwU73DO3EMdD5 Ielz8wvDFVQMBEw63HzD2GN/SS9JE1oaf2MKXZPvBisbwAPuMGGb8VxerV5l X-Google-Smtp-Source: AGHT+IHUyhy6H2RVGOrywT3w4EcatuiZEe2cmmSKkHQYEt9HMgrwHapH3AUJXhMhq3gvgLhl8dA7iA== X-Received: by 2002:a05:6a00:929d:b0:706:67c9:16d0 with SMTP id d2e1a72fcca58-706746f0a52mr14954844b3a.26.1719482474629; Thu, 27 Jun 2024 03:01:14 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Jerry Zhang Jian , Frank Chang , Alistair Francis Subject: [PULL 03/32] target/riscv: zvbb implies zvkb Date: Thu, 27 Jun 2024 20:00:24 +1000 Message-ID: <20240627100053.150937-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::435; envelope-from=alistair23@gmail.com; helo=mail-pf1-x435.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482569138100003 Content-Type: text/plain; charset="utf-8" From: Jerry Zhang Jian According to RISC-V crypto spec, Zvkb extension is a subset of the Zvbb extension [1]. 1: https://github.com/riscv/riscv-crypto/blob/1769c2609bf4535632e0c0fd71577= 8f212bb272e/doc/vector/riscv-crypto-vector-zvkb.adoc?plain=3D1#L10 Signed-off-by: Jerry Zhang Jian Reviewed-by: Frank Chang Reviewed-by: Alistair Francis Message-ID: <20240528130349.20193-1-jerry.zhangjian@sifive.com> [ Changes by AF: - Tidy up commit message - Rebase ] Signed-off-by: Alistair Francis --- target/riscv/tcg/tcg-cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 683f604d9f..fa8a17cc60 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -667,6 +667,10 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvbc), true); } =20 + if (cpu->cfg.ext_zvbb) { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkb), true); + } + if ((cpu->cfg.ext_zvbb || cpu->cfg.ext_zvkb || cpu->cfg.ext_zvkg || cpu->cfg.ext_zvkned || cpu->cfg.ext_zvknha || cpu->cfg.ext_zvksed= || cpu->cfg.ext_zvksh) && !cpu->cfg.ext_zve32x) { --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482690; cv=none; d=zohomail.com; s=zohoarc; b=jLD802dTPgRb0XJ2nIxtOaewHKCFFFflXsjIhoLs6/WOOIhRlpPpXoqzvcmco0znGz/TWLATbS6UXnXHd7+/1QH65DEZ0MnUGx7VOSgbF/3gCIghJERE5b791BBqswIz4KqkhAz/WeX18koM8guhP6M3aH9P3yVk79o6/5mLpKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482690; 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=7Os9dSPxVJFr6h4ij+p8yPFL3Km5u7oyL3YdiKrf7h8=; b=Kf4pJaOZYLGjJGWKaTapfxhGDhbLxLA3ku87ZroPZ3cBP7LyZA+GFx0A6r1wJbNpyzLUYSQNIEEcB++gBUVMJiPWBrYq42Ok+MmMtYF+iEfPQ4tgnac2r5YF8p2dBvVXxhYHTzr8CV/zDPBvHdHA3EoEN87J0UTcECiogLsalgw= 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 1719482690973584.6566392222959; Thu, 27 Jun 2024 03:04:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwd-000508-7N; Thu, 27 Jun 2024 06:01: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 1sMlwP-0004xk-NJ for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:25 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwN-0001aE-Cq for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:20 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-70698bcd19eso2194010b3a.0 for ; Thu, 27 Jun 2024 03:01:19 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482478; x=1720087278; 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=7Os9dSPxVJFr6h4ij+p8yPFL3Km5u7oyL3YdiKrf7h8=; b=babtBiKDnf4m0T9FiUgY1/GJxjuAzSc0RNV7Xekb+hKhLsjQv2bIOiKdTTK2BwK5Ej n7kik76zLlhGRqZNACAU+y/hNQaL4zsO8NfQPeRsBldMKNgevJKJSemQPQLhp0j85tVP LtpcUf2ejb6dRBZ4OHBPwUnDYs0z448frXJ+Qoy1DnwryFtwVseo3oYb2CLsK3xVgtqk u+LvWmeeghv/vdhorgzjOsr9VFXa09UELBWq05RO3pgDL1UBUXS3cvWfjU79LfoeX4P+ Dt3S5MuHrQ6iPPe+Pfqt3kwtgDeoKDhypTDg9Kj6XR3zo3AQ+MMTKvlXH/wO6a8C70wZ uFiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482478; x=1720087278; 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=7Os9dSPxVJFr6h4ij+p8yPFL3Km5u7oyL3YdiKrf7h8=; b=H60AmP0vNHgohV8XNmxL5Zk3z4lXUjOtqiEr/zVqyW/fTkQDG3NV9Ii1gSj2uY5Qr7 U151u3CJiJRNsCGb2VtpAd83avYE/dtTTDvux6XCyQ3siu/Ci8GQU/0FFmvZ/j1CRWYB 1jJJMptUGBNOMYT7IUy9qmKqG1VZa0LuQSddgCdNyuCakNpV5yg46qCZM67HoSP3eT2G BzejGIK+qQA1Gk1rJJGlJq8eyCiL5Dpn2ZVgblj5W+iPT7oY/j/ue2+Cu/Bkaug/P0P0 q9cOhKoo8UI2+P7AnrPKeQAWlR+4JkELbK86kDeN4MbyqHk2dXLy+x7X0IjqXtxZIB53 n5aA== X-Gm-Message-State: AOJu0YzOmQrA342/C/11VyQ38IKXkfIMlza45e1xm/pG3Bu1O1w9yC/N uDLyTiDKS7emI2RHstsW6yzo+zQCA1XasYbC087qc2W4JJi9dzWn67reeWuO X-Google-Smtp-Source: AGHT+IHPnhcEx335l/QMUu2R0HLdkqWzGMCNJM2jLYcikSA3C6F1sAav/BfGKry7hCI3/EsKiMuCEQ== X-Received: by 2002:a05:6a00:1387:b0:706:a5f9:5240 with SMTP id d2e1a72fcca58-706a5f9535dmr5509454b3a.13.1719482477605; Thu, 27 Jun 2024 03:01:17 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Anup Patel , Alistair Francis Subject: [PULL 04/32] hw/riscv/virt.c: add address-cells in create_fdt_one_aplic() Date: Thu, 27 Jun 2024 20:00:25 +1000 Message-ID: <20240627100053.150937-5-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::429; envelope-from=alistair23@gmail.com; helo=mail-pf1-x429.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482691517100001 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza We need #address-cells properties in all interrupt controllers that are referred by an interrupt-map [1]. For the RISC-V machine, both PLIC and APLIC controllers must have this property. PLIC already sets it in create_fdt_socket_plic(). Set the property for APLIC in create_fdt_one_aplic(). [1] https://lore.kernel.org/linux-arm-kernel/CAL_JsqJE15D-xXxmELsmuD+JQHZzx= GzdXvikChn6KFWqk6NzPw@mail.gmail.com/ Suggested-by: Anup Patel Fixes: e6faee65855b ("hw/riscv: virt: Add optional AIA APLIC support to vir= t machine") Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240531202759.911601-2-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- include/hw/riscv/virt.h | 1 + hw/riscv/virt.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index 3db839160f..c0dc41ff9a 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -118,6 +118,7 @@ enum { #define FDT_PLIC_ADDR_CELLS 0 #define FDT_PLIC_INT_CELLS 1 #define FDT_APLIC_INT_CELLS 2 +#define FDT_APLIC_ADDR_CELLS 0 #define FDT_IMSIC_INT_CELLS 0 #define FDT_MAX_INT_CELLS 2 #define FDT_MAX_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \ diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 5676d66d12..e903f05851 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -609,6 +609,8 @@ static void create_fdt_one_aplic(RISCVVirtState *s, int= socket, aplic_name =3D g_strdup_printf("/soc/aplic@%lx", aplic_addr); qemu_fdt_add_subnode(ms->fdt, aplic_name); qemu_fdt_setprop_string(ms->fdt, aplic_name, "compatible", "riscv,apli= c"); + qemu_fdt_setprop_cell(ms->fdt, aplic_name, "#address-cells", + FDT_APLIC_ADDR_CELLS); qemu_fdt_setprop_cell(ms->fdt, aplic_name, "#interrupt-cells", FDT_APLIC_INT_CELLS); qemu_fdt_setprop(ms->fdt, aplic_name, "interrupt-controller", NULL, 0); --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482519; cv=none; d=zohomail.com; s=zohoarc; b=RwyoF71ilS+c7RrdD6oTIR55eF8ZHa8sVWA7mq2nqMkyyEQiqEDRdEoevosl+v7PpSeezAUwd/vscuLqCdNRwOxjg0O7LcKoEPZwjXeKZHCDzEBD6aEjb3xJk09vo6ranIfmryddyKTJYiEcXTpRkAxJAT9I9SS2eiI34jC461k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482519; 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=H5ID2rbibjMInT22rN33D3iPwNHGXHXZ0Ds9aS1mUWE=; b=RMK977jYP5/vYk0JwRzDEJ6mM0QmOtjlD8KITyLSA91LOdWnRGda2tjYbtzTDoA7n07oN7cvh//GKcTxX8c3tDiIIuAHarAcGLDWIszT7KuHjTZzwGQbTVN284bDn4eiImCb++gwhfo7A12osq1tlZUiUnDGW8RHWilW2EX6oOU= 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 171948251902241.13045477544256; Thu, 27 Jun 2024 03:01:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwc-0004zo-VN; Thu, 27 Jun 2024 06:01:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMlwU-0004xw-Hv for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:29 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwQ-0001aV-30 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:26 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-706683e5249so4122001b3a.2 for ; Thu, 27 Jun 2024 03:01:21 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482480; x=1720087280; 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=H5ID2rbibjMInT22rN33D3iPwNHGXHXZ0Ds9aS1mUWE=; b=IIwW7J0oFO2Ypk2fokrX5msUC+4J1nG2T+XyDpAKKFNCFu0cHIzZnCKh7kD5vFiaE/ AhTGGpLiQofXyb7IKp8cAYY/TmJD+7GqQDvSzRHoxN3wKEHoGKYMfHJbFfLTx+3EdM7u UzDarUBnnw9FO346qoBlHLg4k50AO9wNXLRoguh34dyyo5L2kyCrRqTgg4z76q3hVNlQ /CBoSujkwcDL7+vUXI1LFf4NFyN7UsKAaZGR/mYDIOrQutbIP/bkalze16sxkO+6TFu2 5C72eWKpHSanhoZ2yBWJbDuLtFehD1/AkM1U218m6iUnJCoVkTmhGSS58Iq5+56fc9w6 b1sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482480; x=1720087280; 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=H5ID2rbibjMInT22rN33D3iPwNHGXHXZ0Ds9aS1mUWE=; b=cqHH8IURnmsLsha2BUcV2LR0wL2QvzJN9r6sUPxzRqs5n9tOOBgCnQVUz4iX0kozwI fFTVdwHdeGbsv6YVTgww1PsPZM4nNlFBPpFOxxmGUFqm9Dn0guAcEZFzxLNMF+s60jc2 p9c1bjAhpoixalgAJ7G2TFCuPeQJYvCq4yvHTUfk1dYYNLgycyrTPgTOTV5cZQcEEVYB 7fipK+67jGFaR/haQmJl0UNxiiiQASnduo8ZtfoUS0sp90fON0inUj2KeTBjcY+WFnf4 sloKET1zBJHvep2ZjFQAqgHkSPnbJ1TkFqcfipvxLkuki8B8v9CAsUDVE+kZ9qBATfl6 FTVA== X-Gm-Message-State: AOJu0YyKZXmTMaCdYvQd0dre8vJ3Tthpa5brN5AAu324brM0rsVCLPVH gGosdk7N/lIpbY+tdc4sknk4oylixjQ8RYN+YbwGNRw3UT43zJxEJUw/W59Q X-Google-Smtp-Source: AGHT+IHs3VdUTvBR9DQAZMIQqQEGAS9aoS06IajRAyP+mTZpC2UoJNSAG68Kw5vlbqQRL/4d1CCzgQ== X-Received: by 2002:a05:6a00:2289:b0:706:b179:dc5d with SMTP id d2e1a72fcca58-706b179de78mr2408270b3a.25.1719482480283; Thu, 27 Jun 2024 03:01:20 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Alistair Francis Subject: [PULL 05/32] hw/riscv/virt.c: add aplic nodename helper Date: Thu, 27 Jun 2024 20:00:26 +1000 Message-ID: <20240627100053.150937-6-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::435; envelope-from=alistair23@gmail.com; helo=mail-pf1-x435.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482520737100001 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza We'll change the aplic DT nodename in the next patch and the name is hardcoded in 2 different functions. Create a helper to change a single place later. While we're at it, in create_fdt_socket_aplic(), move 'aplic_name' inside the conditional to avoid allocating a string that won't be used when socket =3D=3D NULL. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240531202759.911601-3-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index e903f05851..569d9def24 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -588,6 +588,12 @@ static void create_fdt_imsic(RISCVVirtState *s, const = MemMapEntry *memmap, =20 } =20 +/* Caller must free string after use */ +static char *fdt_get_aplic_nodename(unsigned long aplic_addr) +{ + return g_strdup_printf("/soc/aplic@%lx", aplic_addr); +} + static void create_fdt_one_aplic(RISCVVirtState *s, int socket, unsigned long aplic_addr, uint32_t aplic_= size, uint32_t msi_phandle, @@ -597,7 +603,7 @@ static void create_fdt_one_aplic(RISCVVirtState *s, int= socket, bool m_mode, int num_harts) { int cpu; - g_autofree char *aplic_name =3D NULL; + g_autofree char *aplic_name =3D fdt_get_aplic_nodename(aplic_addr); g_autofree uint32_t *aplic_cells =3D g_new0(uint32_t, num_harts * 2); MachineState *ms =3D MACHINE(s); =20 @@ -606,7 +612,6 @@ static void create_fdt_one_aplic(RISCVVirtState *s, int= socket, aplic_cells[cpu * 2 + 1] =3D cpu_to_be32(m_mode ? IRQ_M_EXT : IRQ_= S_EXT); } =20 - aplic_name =3D g_strdup_printf("/soc/aplic@%lx", aplic_addr); qemu_fdt_add_subnode(ms->fdt, aplic_name); qemu_fdt_setprop_string(ms->fdt, aplic_name, "compatible", "riscv,apli= c"); qemu_fdt_setprop_cell(ms->fdt, aplic_name, "#address-cells", @@ -648,7 +653,6 @@ static void create_fdt_socket_aplic(RISCVVirtState *s, uint32_t *aplic_phandles, int num_harts) { - g_autofree char *aplic_name =3D NULL; unsigned long aplic_addr; MachineState *ms =3D MACHINE(s); uint32_t aplic_m_phandle, aplic_s_phandle; @@ -674,9 +678,8 @@ static void create_fdt_socket_aplic(RISCVVirtState *s, aplic_s_phandle, 0, false, num_harts); =20 - aplic_name =3D g_strdup_printf("/soc/aplic@%lx", aplic_addr); - if (!socket) { + g_autofree char *aplic_name =3D fdt_get_aplic_nodename(aplic_addr); platform_bus_add_all_fdt_nodes(ms->fdt, aplic_name, memmap[VIRT_PLATFORM_BUS].base, memmap[VIRT_PLATFORM_BUS].size, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482546; cv=none; d=zohomail.com; s=zohoarc; b=gOFJ1Oi6q1hHNkYkhgOEt8gyH0c2GEQgDoJwHVITbgVvXrwczCISTxdr2Ve/g3a9WUpxTWue0DDJuVzTHtyPTq1VTTIqCMxLVcxI+93ncbKA6Z5dmyzUlgAkaymCTqcz8u4HzhOx8E30e8/tJxbDuEYC4rSG9MVRe9gw1KFsCG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482546; 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=Lk4RFwjLc+09kgFZ8qZ2DitRvmSjRrWDbykPLIpzSxg=; b=JUydiw/QDkSZlytXCu8YtohrpqVfK3dPKHE4DlW6yWHwc3j0YSvyUg/VcWvYNXkM/pQ/h6xvzb5pY/oEkTYwF2rqULjdeD7m2ka0pyQJy3bp7Q+alzlZoJzVmHeLDZVULCeVspFAUOY1slC7KYhQWsuFlXS7VXpOV+g2UmAH4pQ= 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 1719482546181958.0471871556693; Thu, 27 Jun 2024 03:02:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwd-00050B-Pj; Thu, 27 Jun 2024 06:01: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 1sMlwV-0004y6-5o for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:29 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwT-0001cH-BE for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:26 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-707f9c3bd02so110190b3a.0 for ; Thu, 27 Jun 2024 03:01:24 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482483; x=1720087283; 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=Lk4RFwjLc+09kgFZ8qZ2DitRvmSjRrWDbykPLIpzSxg=; b=DMO48xq7qswwCmjUMpzeHibPETezpVZ8njOi5aoKKScjhEcUPviOWB91I3tkEA28U4 VDQDxv4h4HPKaBPVRx2tk7IZg7rU/GfqB/8zb5maQoW+7R/wZ4hUkzPlKazb0bbkiPG8 dua5+GkPLgU1sPscpbX6UIslprtyjbt9Ed0sGQRnx0MYXvFDNeUAIclXSbt7I61serjU 2eDXKxKn3jge+TtizgOfZB8Oazi/J0B5cg9CaugPhWT9tXcVgEkhwifDAUBB4/jUYB9d eq6BpDt2jdA0cn2o6ocWnGUmmwUBRFmamutg5Kk+5wqJh6owQIWjeZ49hHrqJuxPW0Fm mSlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482483; x=1720087283; 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=Lk4RFwjLc+09kgFZ8qZ2DitRvmSjRrWDbykPLIpzSxg=; b=OoGTDcNt4Wb8QNsbuUsTQenKyQOA1GdDk8PJfyMyECOucbGuzjZue0ipqM7mf568KP jSxNbnwVcy9bNdDWid9IbZi9TMqZdHw1wiAbhCKLqgmToY+nJolXWtFVcMDk4jzouV5z cB0LEVxzHLudZEiCgDPeGL/VA5m6VTqLfi5+Pmfik2NTmfFRtt0xhZU4ZIKpnaONcCOT Mm8BY5KA4OCWNJIUa09USUz55I0dlDAF46TO9XE71JUHPttAA7LesUZpuK6AXiKecPr4 i8r5Rux1/OCbcbf8kFBop/VUCqh9lkPP6sv82B4O61gEW64Y+TzLCoi8M5KzeFDUfIQK IKxw== X-Gm-Message-State: AOJu0Yw/90Sr3d6BYHh2mW488kJ0wt86+nq7C9soIO8q8fgnggouY4kP SsABeWP5PCXuP0ME/GwLWCi64OcO5ppuvCD5zyOtpfpi27LJqvbIBjgbgNxb X-Google-Smtp-Source: AGHT+IGCzweCVynD46ygmLkjsegPoRR0Fb8+6wbRBz6QNj3O8uMTLkcGNsAVe4PuQzEKJYBiDRwwWg== X-Received: by 2002:a05:6a20:7528:b0:1a7:7ac1:a3ba with SMTP id adf61e73a8af0-1bcf7ffa0f7mr10896541637.53.1719482483292; Thu, 27 Jun 2024 03:01:23 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Conor Dooley , Alistair Francis Subject: [PULL 06/32] hw/riscv/virt.c: rename aplic nodename to 'interrupt-controller' Date: Thu, 27 Jun 2024 20:00:27 +1000 Message-ID: <20240627100053.150937-7-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::42a; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482546853100001 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The correct name of the aplic controller node, as per Linux kernel DT docs [1], is 'interrupt-controller@addr'. [1] Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml Reported-by: Conor Dooley Fixes: e6faee65855b ("hw/riscv: virt: Add optional AIA APLIC support to vir= t machine") Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240531202759.911601-4-dbarboza@ventanamicro.com> 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 569d9def24..a803c33e21 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -591,7 +591,7 @@ static void create_fdt_imsic(RISCVVirtState *s, const M= emMapEntry *memmap, /* Caller must free string after use */ static char *fdt_get_aplic_nodename(unsigned long aplic_addr) { - return g_strdup_printf("/soc/aplic@%lx", aplic_addr); + return g_strdup_printf("/soc/interrupt-controller@%lx", aplic_addr); } =20 static void create_fdt_one_aplic(RISCVVirtState *s, int socket, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482733; cv=none; d=zohomail.com; s=zohoarc; b=eo5ktDpxDO+j2fpVANNEhy878GrbTlqzG25xYUOVXZ7dgM0l2oGyowyLrNpo3BjAAQVzBxalcahkImqHE9knALtb7D4QnnaMZGn73xl3fPI7SQWGtEqjwGXFy2W6yPcW2xF8SfvgUBxixv41UeWv9cYe3EkiDrVKMt277dcjMdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482733; 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=Q+eeNlFB8GixGjITkNWps0WtpsIa1zNDxCGuytiuKIQ=; b=P7xX5Y+O/TUydGnb/RQ7r73eQQVssjzgezTuWFXDruWCg6GaUzrluHY53wVj295f6hs3iKB0SMeIY0Uvt9rYXYtRg7q66bdvNTBidZctcGa54rtDCMRj1odn1goQI0nWlwXsOnZQkckGJJ4axPF/BayBvBwpW+FxuG4yN7dvD+o= 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 17194827332361020.7847866693876; Thu, 27 Jun 2024 03:05:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwe-00050V-I9; Thu, 27 Jun 2024 06:01:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMlwb-0004ze-3h for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:34 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwX-0001cs-CH for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:32 -0400 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6f8d0a00a35so7005869a34.2 for ; Thu, 27 Jun 2024 03:01:27 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482486; x=1720087286; 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=Q+eeNlFB8GixGjITkNWps0WtpsIa1zNDxCGuytiuKIQ=; b=SHVsJgK3DcmSAKs6Tcc+sUEiYbSnMdx6IIdW3qtIlDUt+v/QCQjLie4EW/hry4jlWo a0/VA2c7RtpHsSsd67XFLanKHfjTcrLBjThF0Dzp0/jvAhS/o98D4R+mRJ3o2oWUIB/m ViMkdFULeV0UR6xRCgGs+cjPyVCUxrvosQGlFhukVO5pXZMaH+U+w/UZ+ry4iiKNEjoG DT7uO6rcFjh1fETFYJRELpr0Bd9/l5HxxaoKUkMSKuctMhJQ8ur5nqb0J/RoIoN/PUrz BaGqz9MAy6Bi05rC0LPZXns+Rzo22BO3yBzIntOgPr9W25r+fcviU3OvTKhM0mgJ1pxE Ri/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482486; x=1720087286; 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=Q+eeNlFB8GixGjITkNWps0WtpsIa1zNDxCGuytiuKIQ=; b=necpxBhmowDSJ8Vxyjhsp4I2KwPwrGit+h1huy/5I3/mQqExEwUa8ktz0FgC6hiVaP y/UgSC8PYGRswWQgT6Do6y5qKAVC+lbtVgfq5bSdPGgazNOYGZ5vC1nD05GGieQZsSK+ VShCtYREFZItk+Ii6HDoHqJvTNQA5S6EC/TlM1B+HNzC0koAci1W/u4diUB+UfeONIZJ hvCpEFE5ufuRkdmU5FM8/WiIapqf61djzvcSdKUlykkTM7SF/LP6NZ+4aiuKxlQoJgFt JHACEO0O9wa2RBVwEfssTE2AEZACR0aRQ8HK7/z1BzM1Bg98xqIcDhS8T6bR+pZ9Mwmc Uq5w== X-Gm-Message-State: AOJu0YxRMePJzNIeqQj3JBbHansAffMFPZZKh1HVMEjuuO+5zoG7eLrR kgQN19mnQv/9+iZp9fi/ibzaJ4643K4h6c9FPOQ420RrtuYVn4SsfMEpaVLj X-Google-Smtp-Source: AGHT+IFQnutwQGVZAxVvlm79DohdPZj6MHxRC9K9rwOoZofaWpmovVStQXhnQRuGJaj35md+aEREMQ== X-Received: by 2002:a05:6870:1491:b0:254:b7d9:2dd0 with SMTP id 586e51a60fabf-25cfcfa10f2mr14767976fac.55.1719482486276; Thu, 27 Jun 2024 03:01:26 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Conor Dooley , Alistair Francis Subject: [PULL 07/32] hw/riscv/virt.c: aplic DT: add 'qemu, aplic' to 'compatible' Date: Thu, 27 Jun 2024 20:00:28 +1000 Message-ID: <20240627100053.150937-8-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::32d; envelope-from=alistair23@gmail.com; helo=mail-ot1-x32d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482733716100005 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The DT docs for riscv,aplic [1] predicts a 'qemu,aplic' enum in the 'compatible' property. [1] Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml Reported-by: Conor Dooley Fixes: e6faee65855b ("hw/riscv: virt: Add optional AIA APLIC support to vir= t machine") Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240531202759.911601-5-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index a803c33e21..746df3f294 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -606,6 +606,9 @@ static void create_fdt_one_aplic(RISCVVirtState *s, int= socket, g_autofree char *aplic_name =3D fdt_get_aplic_nodename(aplic_addr); g_autofree uint32_t *aplic_cells =3D g_new0(uint32_t, num_harts * 2); MachineState *ms =3D MACHINE(s); + static const char * const aplic_compat[2] =3D { + "qemu,aplic", "riscv,aplic" + }; =20 for (cpu =3D 0; cpu < num_harts; cpu++) { aplic_cells[cpu * 2 + 0] =3D cpu_to_be32(intc_phandles[cpu]); @@ -613,7 +616,9 @@ static void create_fdt_one_aplic(RISCVVirtState *s, int= socket, } =20 qemu_fdt_add_subnode(ms->fdt, aplic_name); - qemu_fdt_setprop_string(ms->fdt, aplic_name, "compatible", "riscv,apli= c"); + qemu_fdt_setprop_string_array(ms->fdt, aplic_name, "compatible", + (char **)&aplic_compat, + ARRAY_SIZE(aplic_compat)); qemu_fdt_setprop_cell(ms->fdt, aplic_name, "#address-cells", FDT_APLIC_ADDR_CELLS); qemu_fdt_setprop_cell(ms->fdt, aplic_name, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482695; cv=none; d=zohomail.com; s=zohoarc; b=mVE7ZDqsHRtqCqujZqpsIZqKt8LVaYtbM4/genQ/8AVhlOvr80vm7Gkttd4nNZ6xDcptGzS8ioFhYljrHMY/VoBKKUh3XMxWmvHjuXXj/byLVmnu/z+GVfVPsUUWBajiwG4+/P0swDBoPctoESfpC+cOxwgg7QiUxtLIwAJ10jM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482695; 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=NDqAmBS4P/7Jqnzeh6wlGENLL0Hv6eaUHFS63phjrpQ=; b=nSg4PJlkFF23UbjKD883GRqV9ANK/7wvs6OID2GsDSpfDm+OWQTLj2M39pRfk6P3k7FBhYENyo1hrLs1FTcZqA0vM+0pKJt88eiQVpBYgOf8lJIYQgusZtf+CNLitn45EG1jj/ZA3HcFqfNK/gk0Unp4kvwjQ4Bzwmoe0cPGy2w= 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 1719482695790569.8932032965073; Thu, 27 Jun 2024 03:04:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwe-00050e-Ol; Thu, 27 Jun 2024 06:01:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMlwc-0004zt-SN for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:34 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwZ-0001dF-J5 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:33 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-70685ab8fb1so3516344b3a.2 for ; Thu, 27 Jun 2024 03:01:31 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482489; x=1720087289; 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=NDqAmBS4P/7Jqnzeh6wlGENLL0Hv6eaUHFS63phjrpQ=; b=NwGhQWC+aEeafpnCFumjA4mAAtu1xoWHHBKYHxbSGwm/63/Bwh+06y/H6XNJkMQwgV l+WjletZaU5aoncMqnosAaAxioTrFCwaKjgOqizLRay5BvlL8V3Rk0fMiKtUlfDxiILw VXGxkpsQKMSfsAtnufsqIB1TgogO8Mtl+q7lhijtfYq8H1jYO0EhtxOBmhn69z1QENNF LBHzOShfFaqthOwKvuIVO8zmj3+Run7de6/rJ23wjFYVk/E+FbxjO1QQTIBDtyM2WdOp z/9eBV8yRRVy0y+wYyvP2rvPqhNjc7SEgefutbEjByY+mBjS+fbOynaGlo87+LQQ2pvn oqEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482489; x=1720087289; 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=NDqAmBS4P/7Jqnzeh6wlGENLL0Hv6eaUHFS63phjrpQ=; b=f20amrJdljXN+Wxd3VrY27cLxLZH9v8bx0dRzXB0cNbnXKFsRC16HFPxLt79y2+VYs zP0Q487iwhqszUgpGDBwJWXLYXwmaEAgyFGZ2iTW7Lc6DugeLwwl60heyrt0unMoCLjy J23+WrI8tob2yXCvhoBZfjUW08REHDXs93GuT9U2ujVG4/tKuuqm7i8MQYn0XSoOqz02 +yZrknv5U1cmG2wifPn5tRnXYwZmng6MN2K3Ps5d9faV+aycjzPCkh2Eanxd3QeeFHwC qZ8eTEJiD+i3cjisUyRYptH/NLq8JDZsFfppcEVuBOgIbCvfwpnD5tkoqOsx8ur4pv+0 DL9w== X-Gm-Message-State: AOJu0Yyr2KXemzs8cAJacIlNxdSeMhzk7FT/17gF1B1kBBdQYX6aRwKv WP4pDw4UM1ZpSyZofy3jNfxRSh0hMx325mnZPdZWTMuMb5/tK7oo0fTv6tpt X-Google-Smtp-Source: AGHT+IFBoWHFZfN1qyNOpp5kKQjNBe/z0Rb8qJMyEvhMj2ZtVT7/RNK7kQAygytkV84Xwgfs05BpAw== X-Received: by 2002:a05:6a00:a28:b0:706:a89d:e98d with SMTP id d2e1a72fcca58-706a89de9f9mr5650135b3a.31.1719482489275; Thu, 27 Jun 2024 03:01:29 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Conor Dooley , Alistair Francis Subject: [PULL 08/32] hw/riscv/virt.c: aplic DT: rename prop to 'riscv, delegation' Date: Thu, 27 Jun 2024 20:00:29 +1000 Message-ID: <20240627100053.150937-9-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::42d; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482697599100006 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The DT docs for riscv,aplic [1] predicts a 'riscv,delegation' property. Not 'riscv,delegate'. [1] Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml Reported-by: Conor Dooley Fixes: e6faee65855b ("hw/riscv: virt: Add optional AIA APLIC support to vir= t machine") Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240531202759.911601-6-dbarboza@ventanamicro.com> 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 746df3f294..9c6b39b7df 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -640,7 +640,7 @@ static void create_fdt_one_aplic(RISCVVirtState *s, int= socket, if (aplic_child_phandle) { qemu_fdt_setprop_cell(ms->fdt, aplic_name, "riscv,children", aplic_child_phandle); - qemu_fdt_setprop_cells(ms->fdt, aplic_name, "riscv,delegate", + qemu_fdt_setprop_cells(ms->fdt, aplic_name, "riscv,delegation", aplic_child_phandle, 0x1, VIRT_IRQCHIP_NUM_SOURCES); } --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482585; cv=none; d=zohomail.com; s=zohoarc; b=RXw6g23vza0YGxCimsFUuD0S80nBvsL/lTisUCHG35JRtS359SOIzeYpboee1loSDBe2rfqmu8oWgUDFsrj9MK0qYJw3GSXXI/umdvkSdGcwNnlGMChczngQS9sZT4yf0+/mbytq31Uz/2qhYK0W/wGhyZ3Y7cB3kIBR/linLYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482585; 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=QU4i8l0CHf3BaV0XsBQvH3OwC1graQuHSr1WC6y7TUI=; b=KF0RKt+7vGUvbFUOpLvFHbTgGjVjhKRpdZq9R8FJlBcMPGuQEQDE4fpOgYWZNMql8MzYacCfuEGUJP6Ux/FDTmyDHCV+U6d95oLkw3paoOags47V37/J/QXPcxwOoAAZw4MbY2jn5dl7sGyl/RI0D/S2VJKq3uAo6kWqVdhtv7g= 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 1719482585947303.2379312619395; Thu, 27 Jun 2024 03:03:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwf-00050y-8r; Thu, 27 Jun 2024 06:01:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMlwe-00050E-9l for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:36 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwc-0001dn-Kk for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:35 -0400 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-70b2421471aso5492570a12.0 for ; Thu, 27 Jun 2024 03:01:34 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482492; x=1720087292; 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=QU4i8l0CHf3BaV0XsBQvH3OwC1graQuHSr1WC6y7TUI=; b=VNJhOCWs3rfVj2aY/0IAtddvdu9/mu6qyIA59U0vEP49c93Q5F035nJm3+2O2vnWXw B2elf4zpXqXqpr7xpPie2XDYxXQ/ofNzmP4PKdpTc/vn935nB7ZTmwmn2kN70joYAZyk oMCYxhEObBKHiwoGsjRgiLD/29pvVDd+I1aEsdqsu9c+yOPvI8JoWCEvU71t/XSx7ra/ 96oWXkirgVZ6Ssng41ohXKrD+KsfhVv/2w5/vroXfa6bs8oh/Rr7NXI37rxTvi0w9qUi aqe90KpZwnd3eweIXOLcu77g0Uuze1zR14UctS9PMFBUC8FLBzq+SXViV60YZ+vINFpF EYOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482492; x=1720087292; 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=QU4i8l0CHf3BaV0XsBQvH3OwC1graQuHSr1WC6y7TUI=; b=oHH/SANnfs4+VAlu1Nx3toOmwl4Qn/GKPwyN9zamGEFua829Hhk3/8F807606G54VL 6SYBMhRpKHD4j4E1wLkf3VeQ2Ud3rTzMZXyNF3RO1vWJ+c6XXMK9ax5Bwjegw+QGIrpR DRCzRELpGOsLEczlmXE97lpimFDtP3tREqDA4W2W/l0pacPa6jUULzII5cA6igIlc4wA P/GL/2hyzbkITtAFrFffGB18gZOr/laGxD8FBiTQt8Rc0Bt9gPG7ON33SiI/dwjnYwPZ hJXnLRIiTwICVJfG5tWtCXr1RP80MutHuHddYUyFGb4NZKgS98SZAwjc4H9Xvt9mD+kd 5GEA== X-Gm-Message-State: AOJu0Yxldh9gcHH07upTRNovbV2T5VtkzHYCHgw4z0NahFVmRisMtFH+ fYzS1VR2fLXBGcVXxJkI8ZP4s/ixvlQBf+sW1OKXyMvr6mks29vzUS0a9AXn X-Google-Smtp-Source: AGHT+IEH7XsxyLynGCWLyoMFRpBeoo20IiYHETZrBSFrYKwLLfTyI0H//zfxmdyOyO+D8QNsdWlSew== X-Received: by 2002:a05:6a20:6387:b0:1bd:1e0f:efa3 with SMTP id adf61e73a8af0-1bd1e0ff0dbmr6675761637.4.1719482492263; Thu, 27 Jun 2024 03:01:32 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Conor Dooley , Alistair Francis Subject: [PULL 09/32] hw/riscv/virt.c: change imsic nodename to 'interrupt-controller' Date: Thu, 27 Jun 2024 20:00:30 +1000 Message-ID: <20240627100053.150937-10-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::529; envelope-from=alistair23@gmail.com; helo=mail-pg1-x529.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482587018100009 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The Linux DT docs for imsic [1] predicts an 'interrupt-controller@addr' node, not 'imsic@addr', given this node inherits the 'interrupt-controller' node. [1] Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.yaml Reported-by: Conor Dooley Fixes: 28d8c281200f ("hw/riscv: virt: Add optional AIA IMSIC support to vir= t machine") Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240531202759.911601-7-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 9c6b39b7df..376e362a68 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -538,7 +538,8 @@ static void create_fdt_one_imsic(RISCVVirtState *s, hwa= ddr base_addr, } } =20 - imsic_name =3D g_strdup_printf("/soc/imsics@%lx", (unsigned long)base_= addr); + imsic_name =3D g_strdup_printf("/soc/interrupt-controller@%lx", + (unsigned long)base_addr); qemu_fdt_add_subnode(ms->fdt, imsic_name); qemu_fdt_setprop_string(ms->fdt, imsic_name, "compatible", "riscv,imsi= cs"); qemu_fdt_setprop_cell(ms->fdt, imsic_name, "#interrupt-cells", --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482658; cv=none; d=zohomail.com; s=zohoarc; b=oLmbtuXE8ZhwlrsQ65RLIVDqZoksEvywuIKA1d6ij0d/yGK+MaZ3VD18WA4biU/YeQPRUrKa0NTpnPbTx/Y6xsemsQ5r/88zLVSIa0rrbXKsbQf6pMlbj0eHeHKGQ86vGVnfeIozXVFydPfet4RVsJySbfsncGr4mYCwsiVGK3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482658; 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=7jZvBLMTasb9eS7DfRHEia3PyJ7fRL3eXKnFZzLUWrg=; b=UijBMx+wmPgShMY2vGigdCTpbns5MGQqIht1ltaY8LJilKNDDn6ldp3UpsFEus6tDXi+ebBOSjIacsdl3efJr05hJqgGdwBqnsG8cbwBTwj/2z8DW8aSx8WZSy+GhYBfwiCPSPR7azzFZU68MMdabhqd7nDEK6vQRgRLIn3DNZ4= 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 1719482658202300.0431205473801; Thu, 27 Jun 2024 03:04:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwj-00052g-4S; Thu, 27 Jun 2024 06:01:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMlwg-00052A-OB for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:38 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwf-0001eP-6V for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:38 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-5c21ef72be3so1036457eaf.2 for ; Thu, 27 Jun 2024 03:01:36 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482495; x=1720087295; 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=7jZvBLMTasb9eS7DfRHEia3PyJ7fRL3eXKnFZzLUWrg=; b=AmPNSxYAouIOWVMAIpmDhG3NyZ0jFczMvMQ/SiKSUSLlyQiduAsZd+BheODN6UaHfy 8+5xnd7NgJbIeBXfIN+8c1yvL5vCW1CvOxfyTRoNuz5nkPCwmjA0UlsZWV6zck7XjehZ Xr9t6D7z2cCvMnVdykK37lBHmpIFefOTyZJ6LZgYAKPVJEwLRmjrxcMud2RpQIo93Jn/ hMJ1aQutOh3AOe/nxGrqPX697NnLJLUbhnOq7ajbSKbtGs6yjGSZvw615Yr2dbV4NwUc 4zxt1yJ5xlj81QsQVqaDgrY2mSd050g/1DNr5S6Aue5ptY/u1Iuks+YMl+XJFxSfeymA p3mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482495; x=1720087295; 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=7jZvBLMTasb9eS7DfRHEia3PyJ7fRL3eXKnFZzLUWrg=; b=TvrpdX3yRrae6VSplIzF7Kjrr431YfYl1BL9zp0xjOYTqcR8nq82a8XME9fuMBHOdd 9cFkatsnFB3ETkuxJ7skX2VSI5rAFNeISBsnzWqSXECN3/5NhnBFCz2WtFR0WpmGNIUV t9VvDMUvLiJh6+Z+si+Nt30wfmU15FcanU/cuJz4kp+Tt0ysdZeLfGtKEg1oMpB9BqSt +DG/53FrEibXQTA56bJ22vFK5lEZtgwcCfba0OoY6XxZz9DjXr1530Mc7SYQ55+jViaG 3zKhyBYmPgs6JEnTl+yPTv4wY8LyMCRHz0as2GMrBDwfugHfcyN2ZEI0MPtquaTCv7TU ChaA== X-Gm-Message-State: AOJu0YwJ0EbD9GmpHxgv9Eq9tSL0e2FvisSeiI1RFvLvfbxG7/JP5dr4 sOxBsn1HCrX3ieDAHuwcnwVDNMA8vUfGuHpQWSIt6zYLsXXVP+Kr2QZ2p2EW X-Google-Smtp-Source: AGHT+IEHV26eGqKyh6Lu7Ts7gc/X3NzhEHoElKQAVXolVRBvMjC+mdR8tnAdZSfiXIq0LvVnFNdq0A== X-Received: by 2002:a05:6870:158d:b0:24f:dc76:f6d2 with SMTP id 586e51a60fabf-25d06e2890emr14257687fac.45.1719482495537; Thu, 27 Jun 2024 03:01:35 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Conor Dooley , Alistair Francis Subject: [PULL 10/32] hw/riscv/virt.c: imsics DT: add 'qemu, imsics' to 'compatible' Date: Thu, 27 Jun 2024 20:00:31 +1000 Message-ID: <20240627100053.150937-11-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::c31; envelope-from=alistair23@gmail.com; helo=mail-oo1-xc31.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482659369100002 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The DT docs for riscv,imsics [1] predicts a 'qemu,imsics' enum in the 'compatible' property. [1] Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.yaml Reported-by: Conor Dooley Fixes: 28d8c281200f ("hw/riscv: virt: Add optional AIA IMSIC support to vir= t machine") Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240531202759.911601-8-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 376e362a68..e1ecf79551 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -515,6 +515,9 @@ static void create_fdt_one_imsic(RISCVVirtState *s, hwa= ddr base_addr, uint32_t imsic_max_hart_per_socket, imsic_addr, imsic_size; g_autofree uint32_t *imsic_cells =3D NULL; g_autofree uint32_t *imsic_regs =3D NULL; + static const char * const imsic_compat[2] =3D { + "qemu,imsics", "riscv,imsics" + }; =20 imsic_cells =3D g_new0(uint32_t, ms->smp.cpus * 2); imsic_regs =3D g_new0(uint32_t, socket_count * 4); @@ -541,7 +544,10 @@ static void create_fdt_one_imsic(RISCVVirtState *s, hw= addr base_addr, imsic_name =3D g_strdup_printf("/soc/interrupt-controller@%lx", (unsigned long)base_addr); qemu_fdt_add_subnode(ms->fdt, imsic_name); - qemu_fdt_setprop_string(ms->fdt, imsic_name, "compatible", "riscv,imsi= cs"); + qemu_fdt_setprop_string_array(ms->fdt, imsic_name, "compatible", + (char **)&imsic_compat, + ARRAY_SIZE(imsic_compat)); + qemu_fdt_setprop_cell(ms->fdt, imsic_name, "#interrupt-cells", FDT_IMSIC_INT_CELLS); qemu_fdt_setprop(ms->fdt, imsic_name, "interrupt-controller", NULL, 0); --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482800; cv=none; d=zohomail.com; s=zohoarc; b=Md/1qd0lC8G5WItg490nd8ENNhmMk0l28AWxcQxFS28/G+ybvm/SVXfGp53kSJofFwUHnOtNZy9W4Rp/asv4grHVWVjsDuVYa8sMANSF5+pUJdBnbs81JpzztsRGEXHX75ImtmYrhqlpDP0gmBgH1B21vC1fSXgs7Q9HPiAv1vE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482800; 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=Mwf6ZQFn6phEZgcwA7tImzDlpbG5FD6Mkg1OZw2C/gI=; b=eWrGF3OIvm2YTcdBf0AzHX0YGixaExJjKl3xzMr3+kV3J5yv2tJsKwj1rnSDOW6rCx3CbvYOr1szmCVUAalIaJHGJrdTsoi7IOSkDRhFEz1xqp7E/CFWFHtVhK/iov4eo6YlVDMzXQ5Yw0ts2LT18t/M+1nxYCZtlte701gDx38= 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 17194828007280.6993618778702739; Thu, 27 Jun 2024 03:06:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwm-00053J-HQ; Thu, 27 Jun 2024 06:01:44 -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 1sMlwj-00052u-Vm for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:41 -0400 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwi-0001f9-Bh for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:41 -0400 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-25c9786835eso3962064fac.3 for ; Thu, 27 Jun 2024 03:01:40 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482498; x=1720087298; 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=Mwf6ZQFn6phEZgcwA7tImzDlpbG5FD6Mkg1OZw2C/gI=; b=mjpYXJQrOodd4UJ2nxyBpG7IBHHiCDmw32CYT6T9hG/A6DGINW4ghWp+P+L9UNOi/6 VIk2vrILZWgwcgfoAR92QrTOt3FGlEekKKxFfaCqHe6BDFhDRi+GD+Q1AgQS7ndyB1Cj EwsapugBp6dV6YLVu7hmo6O35JPMxSXq3TLhZ/oSF7kMqBQpoPQ89Nqj9mnH6fm8UmHv X7AIg2IlZLI3k9CLl414X7oqYuT3LPYgEpwqtXkjXd5Ex0PChqycgl9bw6NAZONDKBMQ 4Js5DtVaJ3KDSV9EUyF2AZruFXfGrQCWzolA8UApMTE4Z7HqDNQkkp+fKbNH76rtP5Pe UN5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482498; x=1720087298; 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=Mwf6ZQFn6phEZgcwA7tImzDlpbG5FD6Mkg1OZw2C/gI=; b=JjYQbXju843hAmojxIDp36L7ExgPaoh5zqNw3p2NfjkqYsDJBOWVCtf0sxo7mdgcgz A1Yv1JKORcHCDySPoKNuFvoKxgeV4xeiDdxihSzk3oy3yoLS3dtkox9f27bLfz87OmG/ eWTBbTIL7uwL0EcypWPH941exF2K09iKMvjpcy1DFoun1znMZNwlKwZhGecLi4VkZbJa rqzax8TqvPh+mMtJaWjBnDL33omuxsTlMa4OT655ZMYJ+vWEZkEV4lP4z1KNy2PpoFwy 9wVQYY5spvgC17KSyRQFZO1V8mq4RoksWjfRVXHaBYx+XVikpli+Wgx/CXCOAkI005M5 kNKw== X-Gm-Message-State: AOJu0Yw7o7hSlePWsYW+1L5Xnd/psAOF0P3HYqcfRjA6G2VQwVwGaj97 1sPiNFAxXqIw32e3f0PcO3VC3cJ+x8oeZeP8MxpoGWcdDAbN8r2wtX7CLiLv X-Google-Smtp-Source: AGHT+IE0Hgjo3Hk5c21CeGSve8WUJ+SeQA364qxrTBKUhliq3RfleWPXm2KlkFfxeoz/oPUkIoFmFA== X-Received: by 2002:a05:6870:4208:b0:25a:6d14:f84a with SMTP id 586e51a60fabf-25d06e37917mr13307074fac.42.1719482498485; Thu, 27 Jun 2024 03:01:38 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Conor Dooley , Alistair Francis Subject: [PULL 11/32] hw/riscv/virt.c: imsics DT: add '#msi-cells' Date: Thu, 27 Jun 2024 20:00:32 +1000 Message-ID: <20240627100053.150937-12-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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=2001:4860:4864:20::2b; envelope-from=alistair23@gmail.com; helo=mail-oa1-x2b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482802052100001 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The DT docs for riscv,imsics [1] requires a 'msi-cell' property. Add one and set it zero. [1] Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.yaml Reported-by: Conor Dooley Fixes: 28d8c281200f ("hw/riscv: virt: Add optional AIA IMSIC support to vir= t machine") Signed-off-by: Daniel Henrique Barboza Message-ID: <20240531202759.911601-9-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index e1ecf79551..9b648540e6 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -552,6 +552,7 @@ static void create_fdt_one_imsic(RISCVVirtState *s, hwa= ddr base_addr, FDT_IMSIC_INT_CELLS); qemu_fdt_setprop(ms->fdt, imsic_name, "interrupt-controller", NULL, 0); qemu_fdt_setprop(ms->fdt, imsic_name, "msi-controller", NULL, 0); + qemu_fdt_setprop_cell(ms->fdt, imsic_name, "#msi-cells", 0); qemu_fdt_setprop(ms->fdt, imsic_name, "interrupts-extended", imsic_cells, ms->smp.cpus * sizeof(uint32_t) * 2); qemu_fdt_setprop(ms->fdt, imsic_name, "reg", imsic_regs, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482748; cv=none; d=zohomail.com; s=zohoarc; b=Dgb6CtnyX4Crn29nPev0gNGcECwvg0Up6P+ELlRHGhq6n5wODxDYmWNTwquInhBbxQVGDOf3mtOjDwOsIklXbXS/TeWlQ1l73yOUk9SPXFOv4+BWNV6soeopUfdi5lBbjbc979C03d632vSd3piZ+BHHn92N/fDiqJNKCi3UoK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482748; 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=VvMRDH0FQIgQ5mFYlmZC/NLgQuA8hoNsfm8XEnF2ha4=; b=Q94mHkGbgRycq5WvYhToynT1P6cjFIynhycJ/Oudbzq7DYSg1X5KIRZjkCIBeu5Yd5mjbYF5aMxi+prU6PizO1Ic204hBUI3fhz6ChUwkjpEUm/kq+KKn7qE+EmdFU2DokPzg+pUf1gtWeX4B83TNxlB1O2JuRzm2s9umG4Ny5Y= 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 1719482748958884.8319252881018; Thu, 27 Jun 2024 03:05:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlx8-0005ZP-DB; Thu, 27 Jun 2024 06:02:06 -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 1sMlx2-0005Mj-O0 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:02 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwl-0001fc-7p for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:00 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-701b0b0be38so6421952b3a.0 for ; Thu, 27 Jun 2024 03:01:42 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482501; x=1720087301; 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=VvMRDH0FQIgQ5mFYlmZC/NLgQuA8hoNsfm8XEnF2ha4=; b=ewn1/Yw0Kahqc7FQrdJanSH5CqPh4GT6lN9IcE1vLS/jDcWNU1scF53YEOUbHll59M h4LCTxdk9LSi5VLfVZYnoP6EGBSgdWb4212NGEt3ThQ60rhk0Jgl93kdcm2gsIB+eSbU KLuYgqx1dNkqC1rzfMoaaHOh3f+LhCseWmnSVhjWlDDhX9KnA9l/fKlbdxlt4zbTwhz7 U5ELR/NL6KME7y4tQSQWAL4YTljtfG33MhamL6ASWx2Xdegis5jpN6/Sf1WljYrF1Rzk VO/98yc80FpR43hYEg4sqw0L93mOWypLbSQAvNg29+Ay7jr5hq28Y12lQUWuzxvLbX2T 1rQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482501; x=1720087301; 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=VvMRDH0FQIgQ5mFYlmZC/NLgQuA8hoNsfm8XEnF2ha4=; b=T1bWmnWy8Y+is1xv3x8gSxCKjaR3usi3uvHSw7y6hgjYb78ZD+oiB1N0/7P/1Awd6n DwyU/TxbpMo8T1PJoWHAjf1EDGTqdJHX4MH+O0PtSaAuPzJVOBgtZ5i7NwH/VVMAva8C hqeV1eoHy2uT6El7FwZXGPME1NFP3Z6JVldxq9G9+MzdSb5Y3tEEUs/OiSVYmRV6yWt6 XrofH8LD6Lndl7rH6+tdiP625jE9FtqF2z91iFaDfACDkNlOLXCPHmamUydBGT3RxXAH lMDqbRzbqScvWkGkI6Id82AoAg1EtICahmy5CAmqXILiVWE4LSSn+XXKTfxC4ZAAje5E QICg== X-Gm-Message-State: AOJu0YwBE57bhdeNlRQdvWp5DPlmL/oXztuWT/bzd7JC4CRWy7I3ki7x Ch0uX3IFYaMfkHUTyxMM5i27+l8siP5iA73Gg5qmqdM1p3gRv4PasTkWSrK/ X-Google-Smtp-Source: AGHT+IGnARjqFpwr5iB98XKm5Y+AJevAy0S0llDAudCOoxX/IkffRKLqnvxqWAbaEKJ7wiUQZs72Mw== X-Received: by 2002:a05:6a00:3cd3:b0:704:2696:d08e with SMTP id d2e1a72fcca58-70681ee315emr13261496b3a.13.1719482501469; Thu, 27 Jun 2024 03:01:41 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Chao Du , Andrew Jones , Alistair Francis Subject: [PULL 12/32] target/riscv/kvm: add software breakpoints support Date: Thu, 27 Jun 2024 20:00:33 +1000 Message-ID: <20240627100053.150937-13-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::431; envelope-from=alistair23@gmail.com; helo=mail-pf1-x431.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, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1719482749792100001 Content-Type: text/plain; charset="utf-8" From: Chao Du This patch implements insert/remove software breakpoint process. For RISC-V, GDB treats single-step similarly to breakpoint: add a breakpoint at the next step address, then continue. So this also works for single-step debugging. Implement kvm_arch_update_guest_debug(): Set the control flag when there are active breakpoints. This will help KVM to know the status in the userspace. Add some stubs which are necessary for building, and will be implemented later. Signed-off-by: Chao Du Reviewed-by: Andrew Jones Acked-by: Alistair Francis Message-ID: <20240606014501.20763-2-duchao@eswincomputing.com> Signed-off-by: Alistair Francis --- target/riscv/kvm/kvm-cpu.c | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 235e2cdaca..748fe5980f 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -1969,3 +1969,72 @@ static const TypeInfo riscv_kvm_cpu_type_infos[] =3D= { }; =20 DEFINE_TYPES(riscv_kvm_cpu_type_infos) + +static const uint32_t ebreak_insn =3D 0x00100073; +static const uint16_t c_ebreak_insn =3D 0x9002; + +int kvm_arch_insert_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *= bp) +{ + if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 2, 0))= { + return -EINVAL; + } + + if ((bp->saved_insn & 0x3) =3D=3D 0x3) { + if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 4,= 0) + || cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&ebreak_insn, 4,= 1)) { + return -EINVAL; + } + } else { + if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&c_ebreak_insn, 2, = 1)) { + return -EINVAL; + } + } + + return 0; +} + +int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *= bp) +{ + uint32_t ebreak; + uint16_t c_ebreak; + + if ((bp->saved_insn & 0x3) =3D=3D 0x3) { + if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&ebreak, 4, 0) || + ebreak !=3D ebreak_insn || + cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 4,= 1)) { + return -EINVAL; + } + } else { + if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&c_ebreak, 2, 0) || + c_ebreak !=3D c_ebreak_insn || + cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 2,= 1)) { + return -EINVAL; + } + } + + return 0; +} + +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) +{ + /* TODO; To be implemented later. */ + return -EINVAL; +} + +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) +{ + /* TODO; To be implemented later. */ + return -EINVAL; +} + +void kvm_arch_remove_all_hw_breakpoints(void) +{ + /* TODO; To be implemented later. */ +} + +void kvm_arch_update_guest_debug(CPUState *cs, struct kvm_guest_debug *dbg) +{ + if (kvm_sw_breakpoints_active(cs)) { + dbg->control |=3D KVM_GUESTDBG_ENABLE; + } +} --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482572; cv=none; d=zohomail.com; s=zohoarc; b=jPROXnBaiCrSlQUm0Q9sjCsiSF6PRC+pYZMzd4sU3RwtcMocHuOpZW9vdFJW4rEIZ13boWUIqml/Son7tNaAXNq3QUMG1WGnmBCcvJ1Hr19Q1L93/kBiRjyncRcKLSIwH+lWB+VmNzw8th7j9OGKZ9riILPr8Rz5J8WP0Dhe6ok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482572; 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=6rwQsSYLKQgi4K97lVRX96DE9ZTfnP0leAGSv9Zh3mk=; b=ESLOoFy2bpw4i5ggOu+G5SJ6JbJsMQQWYozRyUNuu3BXOi0ydMvslnhUBXrpaFM+5L2sJTH27pcCEQ2AvPM7nQxIXm4T0KtMdX/yH3F1blzbdzJkQi0BgidoPx3qXSaxPG72OT5yNseIuCPUjpilYCYXrBhhmsOdp+/PPUetWSA= 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 1719482572050864.9086962922997; Thu, 27 Jun 2024 03:02:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlwy-0005BY-M9; Thu, 27 Jun 2024 06:01: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 1sMlwt-0005AY-Lr for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:51 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwo-0001fl-MY for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:51 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6fa0d077694so3602203a34.0 for ; Thu, 27 Jun 2024 03:01:46 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482505; x=1720087305; 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=6rwQsSYLKQgi4K97lVRX96DE9ZTfnP0leAGSv9Zh3mk=; b=DKl2IhAWV9Voa/EI9v/4ZV4WmNo4oeJfoN+G9GPNwT6pPGPKqT30RgNLSHXj/swq5Y SepFzYqNoamHaksnJDjvLd3+SnMzTyBXLuwRu4mN0vMB5cSjstDxWcGxMlAYq/IhFSUo 2OXRmfYoN+P4T7vjfZpwq4x7Uo5pc2EhTjc2v1nbW6SZZrnTGUs2W590oDLrdYldVOMc uvf8e4axQw9ENF+/ZduhkbaVNIlcKJtN6gpq6VLDhPc9+rQ+4jcqLeApyf+U3NeewXBu nAwTGfbY+CblqRWC6QNdLn24JSTaD0S0mi4LUcjLe9HcCvf4lqycEWJLT5U/8WOB05H6 ZXaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482505; x=1720087305; 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=6rwQsSYLKQgi4K97lVRX96DE9ZTfnP0leAGSv9Zh3mk=; b=GpnU9ZvqiAW6QdzfYT4vPLWXoAbVNvAcsaeTTFiKR2nArxzv16c6Z4uBUrioeCevz2 MOQ8gZDue1YpnL0r9OQCLZZvoBI8EkhpO7+xafu6vWRywNpG+NepIO4ypDM+AzOkMDOd GXgUqvTp+4GBAobEqQ7zTeJ6vub6L767ziPPgr2KU10ygwtepy8CHWGUDUpN2HMlR53u rZqavFVqZg58RmV58Pyihh6DTrRj78KpVWUf/6AWcZqY4ANALRkqs3byGUvAGYUNcQAS TtuxfNVSkBj/4FfNygZDdGEo7lMDYLlenIFPl5xCMqNQxRA50Gl/AljdleNIWWm0gIT1 Zu4Q== X-Gm-Message-State: AOJu0Yzsn+Yxw/w2lpCKStYRtZNdiKIVhSQShPmjsYG0UvB/DI5QRkvk t64QxBQLZ/ReRUBG2RGO7iW9JSeGN5K2ZnQm/3FlM3wKT3iE+mOvKaJ2x8X1 X-Google-Smtp-Source: AGHT+IEAdpCuXdHD4ZYfF65M15BUKtMZ63gCMbHAlTpoJGh9ZLVRDdgQrosXr4m1VYlOqg14l3Zc9A== X-Received: by 2002:a05:6870:4208:b0:258:3c97:f091 with SMTP id 586e51a60fabf-25d06bc9224mr13719286fac.9.1719482504729; Thu, 27 Jun 2024 03:01:44 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Chao Du , Daniel Henrique Barboza , Andrew Jones , Alistair Francis Subject: [PULL 13/32] target/riscv/kvm: handle the exit with debug reason Date: Thu, 27 Jun 2024 20:00:34 +1000 Message-ID: <20240627100053.150937-14-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::334; envelope-from=alistair23@gmail.com; helo=mail-ot1-x334.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482572940100001 Content-Type: text/plain; charset="utf-8" From: Chao Du If the breakpoint belongs to the userspace then set the ret value. Signed-off-by: Chao Du Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Acked-by: Alistair Francis Message-ID: <20240606014501.20763-3-duchao@eswincomputing.com> Signed-off-by: Alistair Francis --- target/riscv/kvm/kvm-cpu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 748fe5980f..1047961fed 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -1555,6 +1555,21 @@ static int kvm_riscv_handle_csr(CPUState *cs, struct= kvm_run *run) return ret; } =20 +static bool kvm_riscv_handle_debug(CPUState *cs) +{ + RISCVCPU *cpu =3D RISCV_CPU(cs); + CPURISCVState *env =3D &cpu->env; + + /* Ensure PC is synchronised */ + kvm_cpu_synchronize_state(cs); + + if (kvm_find_sw_breakpoint(cs, env->pc)) { + return true; + } + + return false; +} + int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) { int ret =3D 0; @@ -1565,6 +1580,11 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_ru= n *run) case KVM_EXIT_RISCV_CSR: ret =3D kvm_riscv_handle_csr(cs, run); break; + case KVM_EXIT_DEBUG: + if (kvm_riscv_handle_debug(cs)) { + ret =3D EXCP_DEBUG; + } + break; default: qemu_log_mask(LOG_UNIMP, "%s: un-handled exit reason %d\n", __func__, run->exit_reason); --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482759; cv=none; d=zohomail.com; s=zohoarc; b=C2TRmALMIIxjFjsGl5SS9e/0I9JMJ41i8sZY6IsX3nFfhYy32aF5qiJth/u3vvdsvVphAxkUByhp+SNIVAUGChvhXHxWQjdCPipNC6hXlkKOng/IHK6iCrsO4/9S4mJLdKrX4vnwcIoZnHozaVnn/fB1dVhq41AvOFwEMyxutWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482759; 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=FLCyPqMhz46RMQyVFn3nlk/YPcVVg7QWv/riYPUXA0Q=; b=j8Ak2J8a04iDV/zgYRI0qZOBzldmJ+4svqP7PnSD6Pi3YHug1f7NW3uWI1cJojCbpV2jYbWEixqWBMC/AQy60Jd7xmdbbsrmjniF0HLHvBfPUKsNCl9cPO2CAxx/S7h/hm2ngVEQ/ZY8gLykuOuhfPBGxfyMXZ/UGRVQBs08mf8= 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 1719482759405718.0530111892838; Thu, 27 Jun 2024 03:05:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlx7-0005SG-A3; Thu, 27 Jun 2024 06:02:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMlx1-0005I8-4n for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:00 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwr-0001gD-NZ for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:01:58 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-6eab07ae82bso5512816a12.3 for ; Thu, 27 Jun 2024 03:01:49 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482508; x=1720087308; 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=FLCyPqMhz46RMQyVFn3nlk/YPcVVg7QWv/riYPUXA0Q=; b=KPk7VPnbbgY29O3yLpxtefZN1rJ7xZ/Bj7YLGr6UqfeFCDoJDccausF2P14L+Mxwq2 k08ZIHWbVgVrnhTFcq6sZVHRlxaAitVRMARl2MsyGxKSJ6zP3XF9/umHBLr4k4NQDKlz Tu952VQ3kYmTApvo06fgzBMT0HFr2RH+SrhqP4XnuN6TbTLWXZeDpsLtTD6CCaHF0R7G 0e9cIGsMETd/DhsNAihJLJryGvaxS2oYofz6NnhAPhQAKxnrNgBYPerFEOXyJFrNx9ul UT2L8qGSEsabnR8V9silJMBbYci0sMgiTFVYOHYTBBaJ1grdFsto6+paeizB5geO3vk5 YKVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482508; x=1720087308; 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=FLCyPqMhz46RMQyVFn3nlk/YPcVVg7QWv/riYPUXA0Q=; b=rFpLMMqN1e3Yo4VxIjmLsz/y3FYd38+rJU2a5jw6xrUwFW0abhhK1IC2p1Lu47Ns87 0+8uF4tzugxs50tb8Pdi8j06kFcTgFSZ2yGVKVwijakefB4SBCRu1bIFCKc68Yx8Z52Z cpS5NQzcvTYpMM+dUd21qSwIejouO9TSKPpV5gG7Rp+6YTpSC3Ykk481onvkce8MCbve 45JUw3cDqK4qtxIcYNKEkd07fmfUc1BljsBDEMilenfhSAg30qTuyzlQSXV5UweAznLP 9bhBuzURn2MQU+v5cY9asGw8vBYV8aWmUMos7xEG9vTrKLbWsClh4xjOJhNM08JRvJhh lUkw== X-Gm-Message-State: AOJu0Yz0rS+xim5IRwFu/pTv/FH9e/fmO0CqjMY89KU9RqgEjl/dl14i Z25QP6H0l6QyfIvtjKlYMBHLll6xe2PrJZFS049XXYAu/o+z+H9ZZqozBRrK X-Google-Smtp-Source: AGHT+IFRsJi8Lk/YkWmZNzyYq1os59XyudwW9DbXAz8UNZbqOp6WG+o9Z93x0Czo5Bhzx8xLQUI1ww== X-Received: by 2002:a05:6a20:ba20:b0:1bd:19e2:744c with SMTP id adf61e73a8af0-1bd19e274e6mr6680379637.4.1719482507949; Thu, 27 Jun 2024 03:01:47 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Chao Du , Daniel Henrique Barboza , Andrew Jones , Alistair Francis Subject: [PULL 14/32] target/riscv/kvm: define TARGET_KVM_HAVE_GUEST_DEBUG Date: Thu, 27 Jun 2024 20:00:35 +1000 Message-ID: <20240627100053.150937-15-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::536; envelope-from=alistair23@gmail.com; helo=mail-pg1-x536.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482759768100001 Content-Type: text/plain; charset="utf-8" From: Chao Du To enable the KVM GUEST DEBUG for RISC-V at QEMU side. Signed-off-by: Chao Du Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Acked-by: Alistair Francis Message-ID: <20240606014501.20763-4-duchao@eswincomputing.com> Signed-off-by: Alistair Francis --- configs/targets/riscv64-softmmu.mak | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/targets/riscv64-softmmu.mak b/configs/targets/riscv64-= softmmu.mak index f688ffa7bc..917980e63e 100644 --- a/configs/targets/riscv64-softmmu.mak +++ b/configs/targets/riscv64-softmmu.mak @@ -1,6 +1,7 @@ TARGET_ARCH=3Driscv64 TARGET_BASE_ARCH=3Driscv TARGET_SUPPORTS_MTTCG=3Dy +TARGET_KVM_HAVE_GUEST_DEBUG=3Dy TARGET_XML_FILES=3D gdb-xml/riscv-64bit-cpu.xml gdb-xml/riscv-32bit-fpu.xm= l gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-64bit-virtual.xml # needed by boot.c TARGET_NEED_FDT=3Dy --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482730; cv=none; d=zohomail.com; s=zohoarc; b=CiWJIHxJhNgKpOucMAwicWhzeis0mKkmLcQjN+sXtu7UNhjxsHcPa356XTxdSGTxu8XdwelakYu+IHwGtn/vR5QfiKLhsJWiQnhnuykShLlwbjIuPAeAjL2SC/oITX5xltxG6EPVE8/wyMEcIuhEHVgzs6rmLkOjZzX/DN7rS78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482730; 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=4VavWRGjlSUvFItRJ7LlymYt3dfzs/4J/YRywHyYUT4=; b=fQLBjbR5E6t1IbsnVz5EZB5ZM2Z9yR5nGZ9DRs7gp3HxakFPJQdXbGSUfC6BJFWjwUO79lwPmylv94oR6zEbtGeuGIsr/cWk9PpQem95nV4G74ybrxUEznHqSE0U9cHq4qlRiaB4yA2j5lc1U5JeH7Ycs8D5UGc6DAr27PGjFpk= 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 1719482730126863.42248752528; Thu, 27 Jun 2024 03:05:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxA-0005oj-QZ; Thu, 27 Jun 2024 06:02: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 1sMlx4-0005Ns-Eh for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:04 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwv-0001gc-JT for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:01 -0400 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6fa11ac8695so4553853a34.3 for ; Thu, 27 Jun 2024 03:01:53 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482512; x=1720087312; 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=4VavWRGjlSUvFItRJ7LlymYt3dfzs/4J/YRywHyYUT4=; b=HdsAfD/tfAgt9gJZRpkeGxVh0VewjVAwVwO0AQy8wsqAvXQMKSqMq4vidgKRqwxqy+ AMRqAMqOqJ9f2qwfjusMcDNyFJ0DBdD2Fu11kL7GuBjxcNmFULlXG5DoNMv6ZL6SeHM+ 9MXkrQvqp35uSLmuaIdwFBgpkcFOVr2Vh68rY4PFMzpH7urm5+uwi0dXtf2MQEunF/Wm GL6gtYmyZykGJd26bI/qeLV6cWz3349pFv3+4zg6fsqjOCS16xO3qIzN8aYzfNfMP1Kw CA1Pp/RTO9U53u9fpPlyxe1tkFZ9MXYmmufjR3SNNejv7L0whCBQ+t0ubIgKREui/HPE +QdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482512; x=1720087312; 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=4VavWRGjlSUvFItRJ7LlymYt3dfzs/4J/YRywHyYUT4=; b=M3GCQbUp185TICG7G8KYJa0LVmW+jQdLrJvwhUoSOAU90H8NOsVm9mufIoPemasGXQ 10gvwTn7nMC6kAn95tU2Xe2pBkADzR+4HASDTg6ZgafdysRbXbAM1WNqJA70lysbkzu9 +pBSgr++9sMkCB6SI1NKqeFrNJOuHottZquETWaWspEL7muMOZWck/wcpEc1eTx3jegi hxsBIGV7xIkw6EL6v1piamkKobk6mSRXjgN+9UYqBCXTvwpdTiMfkJpylF/eB71FBdlH 5jEdlVfegtqSqyOgelTHfHH3MumB9chZo5Ghqtu7FnxECgew/Iiv0ZVFvzQxsCelhVk1 iqbg== X-Gm-Message-State: AOJu0YxWtU5miCdTUtJo7vuq32vZZtj1Uw+XCdHnWhBi3gDbYeyUIHp7 5HGuFglUsTvGNiD0wE20KJo8XWGrF+5uzWedp9jsaj8Y0ej21yDryyTuvGc5 X-Google-Smtp-Source: AGHT+IGCJ3gvtZPhr+7l5Ak6zzh/8JpdZXn298Nr0iWrnT8sforOauQ/Ug94EeZ+xh+NFPjj8+/sJw== X-Received: by 2002:a05:6870:8a24:b0:25c:ba98:27e with SMTP id 586e51a60fabf-25d06c6e4acmr14064728fac.32.1719482511967; Thu, 27 Jun 2024 03:01:51 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Jim Shu , "Fea . Wang" , Frank Chang , LIU Zhiwei , Alistair Francis Subject: [PULL 15/32] target/riscv: Reuse the conversion function of priv_spec Date: Thu, 27 Jun 2024 20:00:36 +1000 Message-ID: <20240627100053.150937-16-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::329; envelope-from=alistair23@gmail.com; helo=mail-ot1-x329.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482731732100003 Content-Type: text/plain; charset="utf-8" From: Jim Shu Public the conversion function of priv_spec in cpu.h, so that tcg-cpu.c could also use it. Signed-off-by: Jim Shu Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Message-ID: <20240606135454.119186-2-fea.wang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.h | 1 + target/riscv/cpu.c | 2 +- target/riscv/tcg/tcg-cpu.c | 13 ++++--------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 6fe0d712b4..b4c9e13774 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -830,4 +830,5 @@ const char *satp_mode_str(uint8_t satp_mode, bool is_32= _bit); /* Implemented in th_csr.c */ void th_register_custom_csrs(RISCVCPU *cpu); =20 +const char *priv_spec_to_str(int priv_version); #endif /* RISCV_CPU_H */ diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 69a08e8c2c..fd0f09c468 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1790,7 +1790,7 @@ static int priv_spec_from_str(const char *priv_spec_s= tr) return priv_version; } =20 -static const char *priv_spec_to_str(int priv_version) +const char *priv_spec_to_str(int priv_version) { switch (priv_version) { case PRIV_VERSION_1_10_0: diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index fa8a17cc60..4c6141f947 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -76,16 +76,11 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uin= t32_t bit, =20 static const char *cpu_priv_ver_to_str(int priv_ver) { - switch (priv_ver) { - case PRIV_VERSION_1_10_0: - return "v1.10.0"; - case PRIV_VERSION_1_11_0: - return "v1.11.0"; - case PRIV_VERSION_1_12_0: - return "v1.12.0"; - } + const char *priv_spec_str =3D priv_spec_to_str(priv_ver); =20 - g_assert_not_reached(); + g_assert(priv_spec_str); + + return priv_spec_str; } =20 static void riscv_cpu_synchronize_from_tb(CPUState *cs, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482677; cv=none; d=zohomail.com; s=zohoarc; b=ZwMvy8KPnhIdrZZ61hVb3tNepDaVcoTN9ONZzicwYW3KMm4zd8ZO4fa9momLE2LbswobxA24CN3OOAyQLb4IQVE+wXqYnA9A5RxpqQ4pcPfgMfPT+uXla2OBN+kKG1cv8SqDjnAlnmm3gTYDXZj45LVkknx15RpPsarJAsLemjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482677; 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=9aUCnalnUbISmCX7rnd1hepHfDNLqfkxy2lbhGVkz3Q=; b=V+debOVicjOTjmLRX83PrNueH2WOn4uiJYAjuZTtlqIGrqhmIP+vZfxwOsnV7JE5hotefRpZNtZzpX5s8H5G+4dXinywuZFw9gJt51IA4EWfdzumpHsimtkJYHIYaXvuhIoev26m15jluA15PSHnSuabz6SwesrVct0mzuiwjc4= 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 1719482677324831.01512308188; Thu, 27 Jun 2024 03:04:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlx9-0005e4-8X; Thu, 27 Jun 2024 06:02: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 1sMlx4-0005Np-E5 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:04 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlwz-0001gs-Uu for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:01 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-706627ff48dso4166230b3a.1 for ; Thu, 27 Jun 2024 03:01:56 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482515; x=1720087315; 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=9aUCnalnUbISmCX7rnd1hepHfDNLqfkxy2lbhGVkz3Q=; b=QBw05HWo76t7Mcq4WaakuBCVs2IMnNTG+50nnqaqY0XH4aKHnkz1gO2VHQzWXNzsm9 2fy6EnsFj3Ro8tnM4MxBzh6l5rXjn15MaSC+V+51uBbH648XTrkCa3JoyVve4bG2dEdI 1ZMs13m+720/JvQqc2W+RSsuEkTP5e29fVoZdby9gvl9x8suqN3IDK1WRZsSVPdoz9fH EeZ+0EcE8XaxEmcAo7ncfPUXnktw3TopmK6ZmtLgD3bPLG/ZnyHZsNE+5dcP+PHqP17f K+lhiNj8SmTuYYZ2kAy+00/sO/ynj9v0SIw8qmC//GKtxPKoonu0n2LS3jRlW3U6GErs yRZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482515; x=1720087315; 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=9aUCnalnUbISmCX7rnd1hepHfDNLqfkxy2lbhGVkz3Q=; b=JrK4CrssR0YHx/Vab+u6/1NFpp0X8IpFYMxTa1gxHmjvS9gLqOn8hfcjjmgOxEwovY a+A//ykbPzvWVP0DveUxK8VNLI8yu/j3Rr0mZaeMJaKhv2pBl70uCHSCF4kvSsSDYqS7 fCYwceOc6vyjlJz3Yc6R8B7SalVrzu50s219vCqwsmF2lEvCzTT5DFzccyBFa7QTJpA0 EqyW7XdglHBWJrEcQYsrhAW9tIu9aQE3q8mk7FLewlLIWg+6lE2mmAca+yX1jKP0DxDU UAkm5y5+3HG9cAMJEJTmXkzYoftqyMp61NrhEousHzsSplOZauHei9M7rdyun7V3Dqc3 YJ7Q== X-Gm-Message-State: AOJu0YxoxejxQC5Yn1Hh6ANDR/qE4GX6xBLXO5kqyEOPIRoD3xk5q6T1 ODDl8zqYB4b5QbHTtA47C14rNYaTUXQIhhenVYiKU/o8MaVWEIopaBTOxJQH X-Google-Smtp-Source: AGHT+IGInls2vv1jQdzTlwg9kn3sxblXT56o/xLZlxbKYxUsJWCMiMOQYlfHt2Kbjq2JsuOaAAOOKg== X-Received: by 2002:aa7:9d11:0:b0:706:6525:611f with SMTP id d2e1a72fcca58-70674751f13mr14066320b3a.31.1719482515558; Thu, 27 Jun 2024 03:01:55 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, "Fea.Wang" , Frank Chang , Weiwei Li , LIU Zhiwei , Alistair Francis Subject: [PULL 16/32] target/riscv: Define macros and variables for ss1p13 Date: Thu, 27 Jun 2024 20:00:37 +1000 Message-ID: <20240627100053.150937-17-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::436; envelope-from=alistair23@gmail.com; helo=mail-pf1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482679412100003 Content-Type: text/plain; charset="utf-8" From: "Fea.Wang" Add macros and variables for RISC-V privilege 1.13 support. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Message-ID: <20240606135454.119186-3-fea.wang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.h | 4 +++- target/riscv/cpu_cfg.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index b4c9e13774..90b8f1b08f 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -96,12 +96,14 @@ extern RISCVCPUProfile *riscv_profiles[]; #define PRIV_VER_1_10_0_STR "v1.10.0" #define PRIV_VER_1_11_0_STR "v1.11.0" #define PRIV_VER_1_12_0_STR "v1.12.0" +#define PRIV_VER_1_13_0_STR "v1.13.0" enum { PRIV_VERSION_1_10_0 =3D 0, PRIV_VERSION_1_11_0, PRIV_VERSION_1_12_0, + PRIV_VERSION_1_13_0, =20 - PRIV_VERSION_LATEST =3D PRIV_VERSION_1_12_0, + PRIV_VERSION_LATEST =3D PRIV_VERSION_1_13_0, }; =20 #define VEXT_VERSION_1_00_0 0x00010000 diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index e1e4f32698..fb7eebde52 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -136,6 +136,7 @@ struct RISCVCPUConfig { * TCG always implement/can't be user disabled, * based on spec version. */ + bool has_priv_1_13; bool has_priv_1_12; bool has_priv_1_11; =20 --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482641; cv=none; d=zohomail.com; s=zohoarc; b=WJKeiu2s5IicLdSf7yibQzANhQcKsMLlyfDQitPKi4iy/kqCUE81wRs/yKwF4ivGUR6AAEkHGOJFQyAfyhqEQEHv7O4qkDvgHxXkbuOivodSNf/4UlmrmY9tAeybpGScrZaFyfkGM2FKEm8X7jzst1YPeJWKKe2X7CeBOmmTr80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482641; 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=zDmHgwe/yLeAAO02Qn8XqoyaNs3eApAfdC0KQgpDfB8=; b=bJwDHFb39eoaoCO1wQRkNC3u+5pPhKnT64kjowc0fvQft50FscF+9Xg8jbzTiQrQ+IrM4NPpD+7yt2jelFaOdadxcomq0ccUFjx9JeHBmjfSn+Ifs1pW1gXzCicH9XrRL9NoqlL95gJ6vsN2a/BLLtFF0A3KsF4X6oC12bK+/BM= 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 1719482641489676.8652897163406; Thu, 27 Jun 2024 03:04:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlx9-0005dR-5k; Thu, 27 Jun 2024 06:02: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 1sMlx6-0005OA-9g for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:04 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlx3-0001h7-0E for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:03 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-70679845d69so3370659b3a.1 for ; Thu, 27 Jun 2024 03:02:00 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482519; x=1720087319; 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=zDmHgwe/yLeAAO02Qn8XqoyaNs3eApAfdC0KQgpDfB8=; b=kmXMw0otjom2D0WUcZ0OSB1ajmuNprlsax5k8BSZhui6qBfpc8pPTqCwz+4XPT/UKL nKSusrnXCFa92p8dAWVv7OAicBNEFzYrPdhgIFW2/wKCpRa++PQvlomxpI45PviqQsIN Xi/HHsVovgKLPVp3j3uoN5YDc8k7mUz0ly/ztSetf/m2JQ77rwSS6qqOtYFGEfgVlFsf 1hmctu4p4zIa3GRXf1OzUkO6qfgZbRhecwEAeDyO5My1vN5lnkRJA3AY1I3+r2BpSBXQ SbwL9x9NTME3brex1QJm9oPSh3qSU10EYwNwE3GGUYGVgSA9+GMKhyx3Thzo+bkYikA8 xbUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482519; x=1720087319; 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=zDmHgwe/yLeAAO02Qn8XqoyaNs3eApAfdC0KQgpDfB8=; b=ZNgRkAaYEBV7+QTrBRbxbA+CRPgANAaCtvVPGlvMpx5iulhNfa0Vd07SxhmcgnaBOR qfEOyb8vro+HDcBhgLfEgD0x0PhzJkh67jKTgp1ZHFnXWorcgrAgrp8s+IkWCyiJDtIh oyxRdDqSTr5zkraNWtPrZm52vDu6FFyA7ucEP+EeS55Bq84pWG1vRp/NkhirgCV6eB/B xwALfKRaEBWKgLs+aIw3zzTf3FQq6tUKweatUFurgtRdx/mBqnim01qKA1rIBTEUzoOv IzHKItuy23pusGx7IOx5yuYvJvYmpkEK8RUDKZ39bh5ewnZu850hYF04/lD+s4IqNtCa kAYA== X-Gm-Message-State: AOJu0YwpSd5cEnRqG3kJ60cHRJ2o36XMU5n83Mlp9+8Na3pp2vYO2trX 5aUGOJCth+kPohQdKi7hM+HQycIf6EakjgMPxk4MESJ9cj42mxVG5UXKiLdU X-Google-Smtp-Source: AGHT+IGeyKfoH3ak7Via7nTbG6lxjunFbANvaBtrMPi/NjXr4Xw4d5s8uMJXWwQl4Py0/eTChl9iug== X-Received: by 2002:a05:6a00:398f:b0:704:3678:3f03 with SMTP id d2e1a72fcca58-7067455bf67mr13919910b3a.5.1719482518770; Thu, 27 Jun 2024 03:01:58 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, "Fea.Wang" , Frank Chang , Weiwei Li , Alistair Francis Subject: [PULL 17/32] target/riscv: Add 'P1P13' bit in SMSTATEEN0 Date: Thu, 27 Jun 2024 20:00:38 +1000 Message-ID: <20240627100053.150937-18-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::42c; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482643300100003 Content-Type: text/plain; charset="utf-8" From: "Fea.Wang" Based on privilege 1.13 spec, there should be a bit56 for 'P1P13' in mstateen0 that controls access to the hedeleg. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis Message-ID: <20240606135454.119186-4-fea.wang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu_bits.h | 1 + target/riscv/csr.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index a470fda9be..c895aa0334 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -315,6 +315,7 @@ #define SMSTATEEN0_CS (1ULL << 0) #define SMSTATEEN0_FCSR (1ULL << 1) #define SMSTATEEN0_JVT (1ULL << 2) +#define SMSTATEEN0_P1P13 (1ULL << 56) #define SMSTATEEN0_HSCONTXT (1ULL << 57) #define SMSTATEEN0_IMSIC (1ULL << 58) #define SMSTATEEN0_AIA (1ULL << 59) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index ee33019b03..a19e1afa1f 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -2252,6 +2252,10 @@ static RISCVException write_mstateen0(CPURISCVState = *env, int csrno, wr_mask |=3D SMSTATEEN0_FCSR; } =20 + if (env->priv_ver >=3D PRIV_VERSION_1_13_0) { + wr_mask |=3D SMSTATEEN0_P1P13; + } + return write_mstateen(env, csrno, wr_mask, new_val); } =20 @@ -2287,6 +2291,10 @@ static RISCVException write_mstateen0h(CPURISCVState= *env, int csrno, { uint64_t wr_mask =3D SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG; =20 + if (env->priv_ver >=3D PRIV_VERSION_1_13_0) { + wr_mask |=3D SMSTATEEN0_P1P13; + } + return write_mstateenh(env, csrno, wr_mask, new_val); } =20 --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482629; cv=none; d=zohomail.com; s=zohoarc; b=TqmL/ntYo3Z1wIYvnKCoiTvFmW05SWJJyYOoOKO6Ai0eb01/CA2Rt9rZ9Nmbz7EAZbaZmDdH3uqDg3REvroG3i/yOYNe2nlf9OTwN0JuSPMHPlUoZSzxMbpA1AnjDeBNEV1T5GmNHmDEN+xlbRfv90gnskGYKiWA92Rq3FDDoGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482629; 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=a7nUOVc8poO2k61wXomx0Mx7KlCErB954jv8HLoD7N4=; b=JoFXjWTLw2o1tkYOVHNuZPjWZKWrtCjIPcwJhTa31edBYM7Ccheay9GuPHStHm0dewOba5Eyk5e/zeqvjg9xLoO28isap0cxiHnFYRJWoGHXzbxjP8Ca+UM7EgphitsrPMmnWvmLjiXe4yfcXfmhtbGnzBnmHeb1XzB8+X+BmKA= 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 1719482629008610.3300802400923; Thu, 27 Jun 2024 03:03:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxC-0005vg-8f; Thu, 27 Jun 2024 06:02:10 -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 1sMlx8-0005X2-0h for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:06 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlx6-0001hp-2B for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:05 -0400 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-700cc97b220so1378844a34.0 for ; Thu, 27 Jun 2024 03:02:03 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482522; x=1720087322; 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=a7nUOVc8poO2k61wXomx0Mx7KlCErB954jv8HLoD7N4=; b=CAPaVOOIEuRxUNytAPIZxfBBCWw26O5pBtA7E5mDAfmXj2Nc/tms3Pz/fP9vEyocwv u15SqqJhXu3bTelfwX8HKQXgdJneQIrv/Ul66YlEhr+pYmPH1YilDmABmMT6OiHHwDpn 7eNVHQmC6kD3ArQ9IOcG2MKJ0Udel5KyO4B+TUFI8/1a1jQBWYzKm6UGQogYiqitQVlK ePwsdeLEcAssLSsVECRlvQd5q0qV79GwcF4md4wA2moJYAz5a9MvbumbVXWn9dn/KcpF 80YScoOYtAHcH14vwP68KF42IHi/1OBtnXjgVoCaVayStPc/9AB3eHtvBhQNUuSg3myJ Ysbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482522; x=1720087322; 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=a7nUOVc8poO2k61wXomx0Mx7KlCErB954jv8HLoD7N4=; b=Vfp/Vgu+ipbVYftCfU4ApNVrkGDYIacyAYtJ/EXEJ3U0qI+ZxaIbZuTvHDFsXm/DCy iqgjUijqFLfmLpXjqJvJ/czZ42nW8K0hvuG0MCSD8Z3/Ju7ps9muy3L8pVRCwquariCD p9/ThfZCTbnX8TDhAcT1FvLphZ7EbPQLWLvoa591hGj70zuaXpGiWCioxPvHLpuqDg2d W7dZzNkc2ipYDTTXSmg1L6fNDphMVxkDb2nMdbQtuEVlQ+Cz+jClYfiE8C9me9sIqpcX I2s/bhTrS+v8XGpbjIrL7HXTLXeYUmMbSIkPWbTuFRd00kO8EaGJjKEGPJBuN0kyUsBm RhJg== X-Gm-Message-State: AOJu0YzvnLJWFmoYNDjPXTF4s+a71uSAuD/+c7gzS9LHJZ23EHrzmI3W k4Yx75KRronlamQ6+3B3qN3royl+pT/gUZplBsP4zU7ehv/EvKQD9Z1G3vp1 X-Google-Smtp-Source: AGHT+IH22vdkztO0vTep4QjsMx/oz+x31D0X47UMXRdwd5yuSWwMQb6dvSOPtSA/SQy8oyrOqlvcKA== X-Received: by 2002:a05:6870:d152:b0:254:8908:4281 with SMTP id 586e51a60fabf-25d06e55f68mr12608592fac.44.1719482522055; Thu, 27 Jun 2024 03:02:02 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, "Fea.Wang" , Frank Chang , LIU Zhiwei , Alistair Francis Subject: [PULL 18/32] target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 Date: Thu, 27 Jun 2024 20:00:39 +1000 Message-ID: <20240627100053.150937-19-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::332; envelope-from=alistair23@gmail.com; helo=mail-ot1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482629209100001 Content-Type: text/plain; charset="utf-8" From: "Fea.Wang" Based on privileged spec 1.13, the RV32 needs to implement MEDELEGH and HEDELEGH for exception codes 32-47 for reserving and exception codes 48-63 for custom use. Add the CSR number though the implementation is just reading zero and writing ignore. Besides, for accessing HEDELEGH, it should be controlled by mstateen0 'P1P13' bit. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Message-ID: <20240606135454.119186-5-fea.wang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu_bits.h | 2 ++ target/riscv/csr.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index c895aa0334..096a51b331 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -156,6 +156,8 @@ =20 /* 32-bit only */ #define CSR_MSTATUSH 0x310 +#define CSR_MEDELEGH 0x312 +#define CSR_HEDELEGH 0x612 =20 /* Machine Trap Handling */ #define CSR_MSCRATCH 0x340 diff --git a/target/riscv/csr.c b/target/riscv/csr.c index a19e1afa1f..6f15612e76 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3229,6 +3229,33 @@ static RISCVException write_hedeleg(CPURISCVState *e= nv, int csrno, return RISCV_EXCP_NONE; } =20 +static RISCVException read_hedelegh(CPURISCVState *env, int csrno, + target_ulong *val) +{ + RISCVException ret; + ret =3D smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + /* Reserved, now read zero */ + *val =3D 0; + return RISCV_EXCP_NONE; +} + +static RISCVException write_hedelegh(CPURISCVState *env, int csrno, + target_ulong val) +{ + RISCVException ret; + ret =3D smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + /* Reserved, now write ignore */ + return RISCV_EXCP_NONE; +} + static RISCVException rmw_hvien64(CPURISCVState *env, int csrno, uint64_t *ret_val, uint64_t new_val, uint64_t wr_mask) @@ -4633,6 +4660,10 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] =3D { =20 [CSR_MSTATUSH] =3D { "mstatush", any32, read_mstatush, write_mstatush = }, + [CSR_MEDELEGH] =3D { "medelegh", any32, read_zero, write_ignore, + .min_priv_ver =3D PRIV_VERSION_1_13_0 = }, + [CSR_HEDELEGH] =3D { "hedelegh", hmode32, read_hedelegh, write_he= delegh, + .min_priv_ver =3D PRIV_VERSION_1_13_0 = }, =20 /* Machine Trap Handling */ [CSR_MSCRATCH] =3D { "mscratch", any, read_mscratch, write_mscratch, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482597; cv=none; d=zohomail.com; s=zohoarc; b=e0oNUzNBEHhv8J7zYXn4y/gMbz9+tMieqaWpSR/p4yQzsd2HqswfXGzs8t9zLtStxwR0FW3fwAtXbP/xdvWrHFlanaAr6wn1F4L0fdsCpC35i4A9Vp5BtlS/Dd8UptBkOWH2T3a1NlVmRffRE0JPVEXRcwhaIUFcHML0AcQmiSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482597; 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=+2ZtPlx1gfPCtUTgrKOFONw9SOdI5ccx3X/2YcbrFmM=; b=a+ACys2YRVqneKXwIA4rnOHasNMZouDwZyc63DEFw9GkMtyqQaQndoEQ/50n5IZhRXicWBXAHfdB7oOh1Egi7WAi1FiTvTEvMUUnpYC7uAuob2gMh5xtjiowwvPxIayll29ZOUdQu/2EpLAxiLHW/L55U0i/dRmUol72nbVoR80= 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 1719482597223794.4418821722289; Thu, 27 Jun 2024 03:03:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxD-00064W-DW; Thu, 27 Jun 2024 06:02:11 -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 1sMlxB-0005pb-47 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:09 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlx9-0001iE-C4 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:08 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-706a1711ee5so1722496b3a.0 for ; Thu, 27 Jun 2024 03:02:06 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482526; x=1720087326; 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=+2ZtPlx1gfPCtUTgrKOFONw9SOdI5ccx3X/2YcbrFmM=; b=PxIX0gePqbQzku9ZTvlyXJNfiIawfRbpmdybJmzvGgGupKSfsMj4mcUIdbECmgk0fm Y1fbn8Dy5GiwDItTy2eET7f/d80+FwwcQCASpePXDN97Jkj7eXG9kdOGzYZ3N1km3JE0 QRQGJaIa4q7FcAzElHhrhSs6NsLLypUrRXCL3LjOiy8Rrj1vVwIpBEbobFvSEZWRqHTy tSc1DmGX8KsOQMCpkdcLZmOuWG8NyBCspexrIBxyEBSaWAZ3tIHehN1n5lGD8V1ySDSx MmcWPTeGlJUazq/G4K/UHnYtWKf5zjI+Bph0PvwrfCt5gUfhgFIbZvblmuzWx0BVpoN7 pyiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482526; x=1720087326; 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=+2ZtPlx1gfPCtUTgrKOFONw9SOdI5ccx3X/2YcbrFmM=; b=iUWHq7Mia6hp2o8l8NNNt88W9yoPFfFbczrUpy7RfEeixTic4eHoPMt4yzXfhf8Tkn kcLqgZubTBO+nwLoypAzcDKoYjprfyFzjj+k2ZKSMwxEDksUxhCtlbgFF7DNyOYo4Pge y9bdTjoojid6aTeXSnaqht+GOifEcCWPvOayptaaFXKNIdIcds0vzl4DGuj1UFH9qC5M QHhXKcpglIadkLcKTud+j6Z3ToJdBLiUdjJeZFnO53aH11IGCdc0XkKTdkDAZQHFhzcj w3kH5bKwL5/nhBFNfU+YtXnKYvh0zyR+B9UDk75HkludQx85FSFa+1HkXyhthVsHImSS MYxw== X-Gm-Message-State: AOJu0YwsxJgbezF06MYVId0Gqd8FAF5fjSOKpVeAeEM2KeewwNrNv6ay Nlf6ZQzkeOLCSW4fXB+rVmJoVnvM0KHEW+KXfBY4r0hlbHMnWoilJaWZACGy X-Google-Smtp-Source: AGHT+IFxkBI4qboUzeCkA6q0oEkqA+onz8dJdSXqVVgMOfzOGt2lZhT62kN0qO0pBVgTb+j9kRvwrA== X-Received: by 2002:a05:6a00:c8e:b0:704:2811:62 with SMTP id d2e1a72fcca58-706745be4c5mr15284762b3a.13.1719482525517; Thu, 27 Jun 2024 03:02:05 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, "Fea.Wang" , Frank Chang , LIU Zhiwei , Alistair Francis Subject: [PULL 19/32] target/riscv: Reserve exception codes for sw-check and hw-err Date: Thu, 27 Jun 2024 20:00:40 +1000 Message-ID: <20240627100053.150937-20-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::436; envelope-from=alistair23@gmail.com; helo=mail-pf1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482599108100003 Content-Type: text/plain; charset="utf-8" From: "Fea.Wang" Based on the priv-1.13.0, add the exception codes for Software-check and Hardware-error. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Message-ID: <20240606135454.119186-6-fea.wang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu_bits.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 096a51b331..c257c5ed7d 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -673,6 +673,8 @@ typedef enum RISCVException { RISCV_EXCP_INST_PAGE_FAULT =3D 0xc, /* since: priv-1.10.0 */ RISCV_EXCP_LOAD_PAGE_FAULT =3D 0xd, /* since: priv-1.10.0 */ RISCV_EXCP_STORE_PAGE_FAULT =3D 0xf, /* since: priv-1.10.0 */ + RISCV_EXCP_SW_CHECK =3D 0x12, /* since: priv-1.13.0 */ + RISCV_EXCP_HW_ERR =3D 0x13, /* since: priv-1.13.0 */ RISCV_EXCP_INST_GUEST_PAGE_FAULT =3D 0x14, RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT =3D 0x15, RISCV_EXCP_VIRT_INSTRUCTION_FAULT =3D 0x16, --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482584; cv=none; d=zohomail.com; s=zohoarc; b=HfBYhFpe495xOZ4mZmZ/kYFNSWtPkD+143nkOihDUNOlXbGsdY6lUXYuhWyTE3GwKnnCfHvD5Ftbd33LBck3MlyH87la+BmP1369B6rZsQz0lVzMeL35Y/QpAh/OuL0qtuiGQBjwrfhLpC0nNI3v/xFyJhYz5qcUdArYMLteI/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482584; 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=x13WhTxcZG7M/CZkZViFdoYco9hukctsn/jx6KYUPo8=; b=foVHnOgUzjBP5Ch8nB3mN8H/c0TF1ZM5q4+yvPGSHfFG4no487A5ob79zkvxUku0SjuU14fk0dtAY/E8ey2jOm0eKlnNKZ3QAy7I5BcRK2E7C9RRjXmjRBDjZkfhicN8/8H4IvvopQXw4oMyMAZrne1sjxhgluE93XLcvzjyM1w= 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 1719482584190170.55162101521398; Thu, 27 Jun 2024 03:03:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxG-0006QG-BT; Thu, 27 Jun 2024 06:02:14 -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 1sMlxE-0006EV-Pc for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:12 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxC-0001iU-NO for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:12 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-70675977d0eso3947974b3a.0 for ; Thu, 27 Jun 2024 03:02:10 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482529; x=1720087329; 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=x13WhTxcZG7M/CZkZViFdoYco9hukctsn/jx6KYUPo8=; b=FaY/TtcOWF2RdWwUgWTvN9GH6c8NfpwiZneO3E3/844XFtbPLxAB2/ulQv4UUId4G+ 7vwZIh9LzhBQjzgaHJWclmXX24KV3RZ1Eb2EetxqQ8vlhnRxVwxXfy0RX0G6b2l5qSQX a8zJpZx3wKHmkq7wGLRi5LRNjJy/+ZDa38U8P28aLQEPlG7fbChUcfvEXC0rgfLxS4nX S+wXWA+xNOLeQQ3BYU0JvDfIUtWSFOsULZYvzfpAQRy2ZxYVhoFYEFA+N9vn8a6OVEc+ 4nnuSBlI638qkUQ73c2nw8Xxa1DjY3+W34eADqer7zpxM8PTSMgD0nm5Dhw3GVGC3FiY 7/RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482529; x=1720087329; 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=x13WhTxcZG7M/CZkZViFdoYco9hukctsn/jx6KYUPo8=; b=uzERbsACf9zpT0Hhg7up4WSgTUuBX8w1VSDXnU3/baIQ+0m+K+o4A2QIPd8uPDvUzT MdvsehYYxiaHQTy4A1kfpMqjpGFuCcE4aG79ejTEcWRxpND2hVPkE4wLws4ZR7j6erMN rY4h9weqEpOqGmlyZlx7TXgfH6dOh6sfd/C+4EG3BoIuQb9ClEsTDXcW6UOl6ypKG6va OrisLNOvxAnYpD1fG/Ej4w0KB7L74FtMZCXn1Jy1t53Q7FWp5xCTxCKAF6xtH0hlziAG ri5q1z3i1jS4T1Fn4BG7DEUC819P7iO5j+nojGV11hCSvFTEY6PdLX4yfhXwKTdSIFpb VVCg== X-Gm-Message-State: AOJu0YwfDgSyh/aT8e+mhxPyUidbBEWUKf3icMvagxOBEiYgm3cQ1L3K 1a3neR1byo537pKHobql/bUM9peXkD0BAHaqm2mhQ3+W234vliZ5Fz/KYl1L X-Google-Smtp-Source: AGHT+IGaiiOvIvsq9mFKFWmueQB73fzF7cruGF30UBAPwOZ4omNUwzBlmIR7WQ4djt/rF4Aa1aE99g== X-Received: by 2002:aa7:92c2:0:b0:705:c029:c9a7 with SMTP id d2e1a72fcca58-706745b6d61mr12030306b3a.15.1719482529019; Thu, 27 Jun 2024 03:02:09 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, "Fea.Wang" , Frank Chang , Weiwei Li , LIU Zhiwei , Alistair Francis Subject: [PULL 20/32] target/riscv: Support the version for ss1p13 Date: Thu, 27 Jun 2024 20:00:41 +1000 Message-ID: <20240627100053.150937-21-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::42a; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482584987100001 Content-Type: text/plain; charset="utf-8" From: "Fea.Wang" Add RISC-V privilege 1.13 support. Signed-off-by: Fea.Wang Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20240606135454.119186-7-fea.wang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 6 +++++- target/riscv/tcg/tcg-cpu.c | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index fd0f09c468..4760cb2cc1 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1779,7 +1779,9 @@ static int priv_spec_from_str(const char *priv_spec_s= tr) { int priv_version =3D -1; =20 - if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) { + if (!g_strcmp0(priv_spec_str, PRIV_VER_1_13_0_STR)) { + priv_version =3D PRIV_VERSION_1_13_0; + } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) { priv_version =3D PRIV_VERSION_1_12_0; } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_11_0_STR)) { priv_version =3D PRIV_VERSION_1_11_0; @@ -1799,6 +1801,8 @@ const char *priv_spec_to_str(int priv_version) return PRIV_VER_1_11_0_STR; case PRIV_VERSION_1_12_0: return PRIV_VER_1_12_0_STR; + case PRIV_VERSION_1_13_0: + return PRIV_VER_1_13_0_STR; default: return NULL; } diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 4c6141f947..eb6f7b9d12 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -318,6 +318,10 @@ static void riscv_cpu_update_named_features(RISCVCPU *= cpu) cpu->cfg.has_priv_1_12 =3D true; } =20 + if (cpu->env.priv_ver >=3D PRIV_VERSION_1_13_0) { + cpu->cfg.has_priv_1_13 =3D true; + } + /* zic64b is 1.12 or later */ cpu->cfg.ext_zic64b =3D cpu->cfg.cbom_blocksize =3D=3D 64 && cpu->cfg.cbop_blocksize =3D=3D 64 && --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482810; cv=none; d=zohomail.com; s=zohoarc; b=fvVQn4+M0KR0CqBwX+MsHBrwHF6A8Oz/hd2ezHSY5nsmuTeKRdqBx0Yy88C9CFVI/P+DBh4GRVQXJDqM9UvPPYOhFC+WKi3zOITJbPeFO34i5SCRqEEmsvtUSKWcn9v/iMqBaTfYf2BBI2LAgn1eSovyt0tz7lcWmvUo4QH21zU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482810; 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=EsLiAHFyCsutJDc2599A4Vu0YvGo61TqCblpFBlIdck=; b=V9uRKVx2uH+VyFccVBgZNHC1Im3I0BgXbtGuIvNVmlZVMTjpyLlFuYl+j9ls+JbZV1XFBlr666ovsr3fVSm3tZ/8UCSKeT/R3dXCXnwvQKbR5FF32nW0GNLuqeQw3V4vGXQGdOJYYhGyTDBEKTHUMj9LLBTOTEhhL0+ZPSznHGs= 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 1719482810444991.4495783780941; Thu, 27 Jun 2024 03:06:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxK-0006i8-AM; Thu, 27 Jun 2024 06:02:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMlxI-0006Yb-9x for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:16 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxG-0001ii-Lh for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:16 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-70698bcd19eso2194700b3a.0 for ; Thu, 27 Jun 2024 03:02:14 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482532; x=1720087332; 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=EsLiAHFyCsutJDc2599A4Vu0YvGo61TqCblpFBlIdck=; b=U69pmD2lBQfTcJozBSpCx1h2CJkKbJy3R8xznx2YmnodboNo5s0SoXFeJNs5Ipr+K1 Jp0ehn/fxbhk9oZr7MfW5KwGlziWYoyjeeNOD2clC2yyF2N08WGI/0ES4MlYxUytPgKa 5j/fNaU+lTJBNcI4oc3l3U6jEdBueK6buRwjJuSyk8IPW4B717jx5xhOIsuOcFfmKawJ 5ZZtvcFskASerC5J13bncOjQEHLtwC0bXuUBsgx+pKDUR31XDtEGJuxofqQe5Fn580ZY 64IwSoI5r3Ra5l01Y9kRkz3Iu7acjJF7obMVqaYkobwTVZAgiTOTe30DycZTenhhHixN PXzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482532; x=1720087332; 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=EsLiAHFyCsutJDc2599A4Vu0YvGo61TqCblpFBlIdck=; b=xMUMSez3g3vDgXnhtGaGNhl6YZk/WGkOdlXapQKMzFBRxzqnjD+dFxm6r3K8tDra5y xuwoZKdJh4eL77OB4BGyEybOKwYl6pEHkDfHTqYfXb8BDjkYF5c/5nv6njdZW9qhXVcW neeY7PB63mKEX14LC7Pw+Vrk8adxTF89TJPVwatyFBZfvVwVo4ENC9rpwGhaEoM8O9kC WLayy/rPIqsqBWuahlqFNc59fCpJ6VhLOLqOWu4hn061OjSJfdaCWWpy9pNOni8lGkjG 0OnbxNnEsVjN6IGUScn2527v5ekVOmAfrSgN1hV+xnhviF033mUlFGuOO7zq+V6XwDFp lx0A== X-Gm-Message-State: AOJu0YxsCzi3xqNtpYcObGlkqvSavrJQx2nLH/V/ST+dvLFqKPMq/qmA NhYdxp4vbHTIJzbIxHY6ASxJkB1lqHi0xdsHYZ1hYrquhC/XSzmQMJQuV1Y+ X-Google-Smtp-Source: AGHT+IH9IJrxKTJsMDGKvGKulwVzNLPAtUGlNCLckZC5UBnfGaMyeLlO1z0jX7uz1WFsxeAX4C6ZqA== X-Received: by 2002:a05:6a00:2195:b0:706:6c38:31f3 with SMTP id d2e1a72fcca58-706745830e0mr14179622b3a.8.1719482532046; Thu, 27 Jun 2024 03:02:12 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Sunil V L , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 21/32] hw/riscv/virt.c: Make block devices default to virtio Date: Thu, 27 Jun 2024 20:00:42 +1000 Message-ID: <20240627100053.150937-22-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::436; envelope-from=alistair23@gmail.com; helo=mail-pf1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482812067100003 Content-Type: text/plain; charset="utf-8" From: Sunil V L RISC-V virt is currently missing default type for block devices. Without this being set, proper backend is not created when option like -cdrom is used. So, make the virt board's default block device type be IF_VIRTIO similar to other architectures. We also need to set no_cdrom to avoid getting a default cdrom device. Signed-off-by: Sunil V L Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-ID: <20240620064718.275427-1-sunilvl@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 9b648540e6..bc0893e087 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1764,6 +1764,8 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) mc->init =3D virt_machine_init; mc->max_cpus =3D VIRT_CPUS_MAX; mc->default_cpu_type =3D TYPE_RISCV_CPU_BASE; + mc->block_default_type =3D IF_VIRTIO; + mc->no_cdrom =3D 1; mc->pci_allow_0_address =3D true; mc->possible_cpu_arch_ids =3D riscv_numa_possible_cpu_arch_ids; mc->cpu_index_to_instance_props =3D riscv_numa_cpu_index_to_props; --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482717; cv=none; d=zohomail.com; s=zohoarc; b=cMyBEj+PYuZOhalZPZOEzu60yq56oMPgL/ZkAB1pf4RG3N4Rl6DDjyjpfBRl3wKRXguKoNd3poyjQ9ElbmxYfspfQ8lhEeVbfDJrYdafeU147yUxqA5josGmuGXtre1l23YUbmsKoEjqvGFyFMDaJCCb/5cMbm/qKczyDp7aAj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482717; 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=8hc3Rw3zZB7nBLeNjAJQMLk441yVfIEAPDQCPVGgw7E=; b=M1xEuEc0NV/r+4eoxEUqRH+yBdJImxRmjwNaiFrZgCASR6w0+9X9oofmAtDvgQBMXhyot1YLQ7Nr5E4NG0W7+S2xmxlshew0SbKZp8S7XuVfCBZj+S1FnUY4te6gB+60gxDKf4acI8412OpLMDoXGPVybbRVcnPfwZNeH/UxWZs= 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 1719482717574938.3418006955059; Thu, 27 Jun 2024 03:05:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxM-0006lK-DM; Thu, 27 Jun 2024 06:02:20 -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 1sMlxL-0006iZ-DW for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:19 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxI-0001kx-OK for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:18 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3d55e2e0327so1343303b6e.0 for ; Thu, 27 Jun 2024 03:02:16 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482535; x=1720087335; 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=8hc3Rw3zZB7nBLeNjAJQMLk441yVfIEAPDQCPVGgw7E=; b=BAlzntdeuFh3kWd5WQCIoOIdU4j/5p0jwh28UHfMOqpW2oaQe2pYxP9UFWspJUwLYh K8jOjd8JNWZnV/zhNt4Bf0/FX6oiKhMHjhldsKkh+wMTP6d5ocwn7L+bSYiWfxMZVEag 3uVg3HyuiVUTAoPGTYMXTK6Ua5HJd16kJZe9RlPDwCjZJQalMypQ6Hu1RE4RuM0l34Wz nTXUxIMDgiDQcqrteHOAfiIVb6wPrXwVtMM22gI9juWqXjxjhyfXk4ixJ0fybTYlwZ5v VLwbcfxnvR4sIdfxyy0rC4WW1BDbVd9BcjUBG5GIWnHHfUxLu86ShPq80KS65VfLaizi /qqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482535; x=1720087335; 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=8hc3Rw3zZB7nBLeNjAJQMLk441yVfIEAPDQCPVGgw7E=; b=o6qrhd70PSe6kAaSpqvHVpzDvJUcUSNHgNreDbRVoRIf9owZWw2PKMJIvQwmYVs/is GbDvWyNo59mqHjDIhEBfz6oFaUF4R2cJ5WnZHEp2rNqMInLsrpUIF/8RFqPsqiGvAybF YL4RYliVZNkwUIccCGg0o8qZt2oZ1Nl1v+pEMDzBe/wkdUeJ6l/2pknhUBl/Zh01mht0 CGCzMjdEFlgOjVrBYusLpv9qbIHUAfGCE7vtE0q+1mEFP8wpojtcKhM7oYRlz9ZxuEp8 AsOkDbxfqXUo0Q5Phz40sbXzE1I4sKWn0W0PaLwIiQPD1tqbI8etny9ISPVuwRRme51v ZbVg== X-Gm-Message-State: AOJu0YyQutngg0mCeKeuCCaLr/CNJooyaYXwlTbKeR4PTO/gCQvQqfPG TRQwfGzaXk8zvYRcDFLkPSgw4vrkp14m0w59YoiAYpqO0pgPQJXQh9YVfwtI X-Google-Smtp-Source: AGHT+IEmGd736Qq7Y4LelCYcKP5+YlZHytq2n78dnsUYA90un5EXbsXat4u9vpDAhM7Q1eGqoJi8Fw== X-Received: by 2002:a05:6808:1412:b0:3d5:6575:6fe4 with SMTP id 5614622812f47-3d56575710dmr3285784b6e.26.1719482535270; Thu, 27 Jun 2024 03:02:15 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Branislav Brzak , Alistair Francis , Richard Henderson Subject: [PULL 22/32] target/riscv: Fix froundnx.h nanbox check Date: Thu, 27 Jun 2024 20:00:43 +1000 Message-ID: <20240627100053.150937-23-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::233; envelope-from=alistair23@gmail.com; helo=mail-oi1-x233.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482719608100003 Content-Type: text/plain; charset="utf-8" From: Branislav Brzak helper_froundnx_h function mistakenly uses single percision nanbox check instead of the half percision one. This patch fixes the issue. Signed-off-by: Branislav Brzak Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson Message-ID: <20240608214546.226963-1-brzakbranislav@gmail.com> Signed-off-by: Alistair Francis --- target/riscv/fpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/fpu_helper.c b/target/riscv/fpu_helper.c index 871a70a316..91b1a56d10 100644 --- a/target/riscv/fpu_helper.c +++ b/target/riscv/fpu_helper.c @@ -676,7 +676,7 @@ uint64_t helper_fround_h(CPURISCVState *env, uint64_t r= s1) =20 uint64_t helper_froundnx_h(CPURISCVState *env, uint64_t rs1) { - float16 frs1 =3D check_nanbox_s(env, rs1); + float16 frs1 =3D check_nanbox_h(env, rs1); frs1 =3D float16_round_to_int(frs1, &env->fp_status); return nanbox_h(env, frs1); } --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482670; cv=none; d=zohomail.com; s=zohoarc; b=W03e1uG6pfnf2qBcmutK6ZB85kgHwh/IW0rmKBknFfZ2jk3TpW504nDlwWIcyiL/2CbNEKjqX9uCnYZQBlKzvSykmw/6LV3RcegauZwlfMJRdYKNFE+1OESlG8CPvIWETeK73lxB09EJQRyMq6JyhAQ/xQwrOoqvLCF1x5Jd5eY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482670; 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=3PBJYVBwlZcM3vrZPZTYGjjElJE2GDldPlxWfqT4Lng=; b=Yc+S5cWfnM8VMWP1Or3+WVGsk9HcYnE3qSlHief9UMRpNKbN0PH4vN4GWDt7SB9G6/ssH4A+KsjcNgvQqDIgwKzPDLTR69CQEsYaEPEuLy63E2Fziqsmb67n/1ATDIw5m5ZWAy0wLkG6/AykqiT4/IfIKj1vBUio4xv89en/voM= 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 1719482670927775.5422642223319; Thu, 27 Jun 2024 03:04:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxj-000753-Q1; Thu, 27 Jun 2024 06:02:43 -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 1sMlxP-0006m0-19 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:23 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxM-0001sU-5X for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:22 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7065a2f4573so4560719b3a.2 for ; Thu, 27 Jun 2024 03:02:19 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482538; x=1720087338; 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=3PBJYVBwlZcM3vrZPZTYGjjElJE2GDldPlxWfqT4Lng=; b=VOp8qkKXUWdRmjQJ8EuZ/k0Q+H/gpH0K2WssbFr4ET9e6FZoowmfhxxsEOZkIP04ND JRXVH8VzACFgDadg/c6ZFs8PtSYUuL/xIptrxvq55XzVtYGuzoEII/CS3Ll+wl9aEiUU DYMfB1O99tx8L9CE3C9WYjhAqTjDRthTQlNq69YGW3LkesUjZmI+TPlRweeakqXwnY/X WtsUtO2DHLU3LE8e91SBxCMU5lxMY8kTj4mt9U7gy7S3ZxZR1OaiFuZL0fblZ+sPDNc4 ZkU/Dca4eGWnWLL/gzhh9R1TKN9dOqbSWirNwOsTC8B4w3ox9J7YMdBDUGvkgfNxWg+8 V9MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482538; x=1720087338; 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=3PBJYVBwlZcM3vrZPZTYGjjElJE2GDldPlxWfqT4Lng=; b=KlPkRdvkfTw6ogqgsbltpllPwV+iqyWUFFb3ZGLnCtiJCejd2zplbUZWxm3ofdmxrN cykiOJSlMlv4hD8Q/b4U48KZvMOvIhT7L9F9ecupc+Bm2ojLz4i1M1BTjlF+eoTWfbTS cCXk58t5zfQoDbh9y27jzjPqlCxH+oSUa+SdSEqmZ3T5Bo6237bAGWbPH/E97+hU/dub FUYvFQ7/bjBCrzCyaTWN85LUFch02YulgTUElXoweM5ou9k9rhDR2/dh42Xmp5aI6oRs LOvBMeMQd0kYMcZ9DovSH9YMf90ITayZ+35JVe5dcMbQ+B4g3dWCFVG/LJjZqxgnMEhA 6m1Q== X-Gm-Message-State: AOJu0YyL1ch/Ihph3rm2QN9hd5EvZE3YPK8ZsV7iFVlHZrgtO2ZgDxkJ TTqbQOlOJDT2gGwBKpdmUEFvHyFthx+7DrYJqA/EArR7SImRsrZ3Fo84Vu9R X-Google-Smtp-Source: AGHT+IEJQM4eKkM4nv7oVkK3yujEJlkyul5WTiFcWAod+14xI0UFGni0M/8MtptwtINoDCwLVzUDgA== X-Received: by 2002:a05:6a00:a06:b0:706:9073:45ee with SMTP id d2e1a72fcca58-70690734663mr10959698b3a.25.1719482538319; Thu, 27 Jun 2024 03:02:18 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Atish Patra , Alistair Francis Subject: [PULL 23/32] target/riscv: fix instructions count handling in icount mode Date: Thu, 27 Jun 2024 20:00:44 +1000 Message-ID: <20240627100053.150937-24-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::429; envelope-from=alistair23@gmail.com; helo=mail-pf1-x429.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482671427100005 From: Cl=C3=A9ment L=C3=A9ger When icount is enabled, rather than returning the virtual CPU time, we should return the instruction count itself. Add an instructions bool parameter to get_ticks() to correctly return icount_get_raw() when icount_enabled() =3D=3D 1 and instruction count is queried. This will modify the existing behavior which was returning an instructions count close to the number of cycles (CPI ~=3D 1). Signed-off-by: Cl=C3=A9ment L=C3=A9ger Reviewed-by: Atish Patra Message-ID: <20240618112649.76683-1-cleger@rivosinc.com> Signed-off-by: Alistair Francis --- target/riscv/csr.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 6f15612e76..432c59dc66 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -762,14 +762,18 @@ static RISCVException write_vcsr(CPURISCVState *env, = int csrno, } =20 /* User Timers and Counters */ -static target_ulong get_ticks(bool shift) +static target_ulong get_ticks(bool shift, bool instructions) { int64_t val; target_ulong result; =20 #if !defined(CONFIG_USER_ONLY) if (icount_enabled()) { - val =3D icount_get(); + if (instructions) { + val =3D icount_get_raw(); + } else { + val =3D icount_get(); + } } else { val =3D cpu_get_host_ticks(); } @@ -804,14 +808,14 @@ static RISCVException read_timeh(CPURISCVState *env, = int csrno, static RISCVException read_hpmcounter(CPURISCVState *env, int csrno, target_ulong *val) { - *val =3D get_ticks(false); + *val =3D get_ticks(false, (csrno =3D=3D CSR_INSTRET)); return RISCV_EXCP_NONE; } =20 static RISCVException read_hpmcounterh(CPURISCVState *env, int csrno, target_ulong *val) { - *val =3D get_ticks(true); + *val =3D get_ticks(true, (csrno =3D=3D CSR_INSTRETH)); return RISCV_EXCP_NONE; } =20 @@ -875,11 +879,11 @@ static RISCVException write_mhpmcounter(CPURISCVState= *env, int csrno, int ctr_idx =3D csrno - CSR_MCYCLE; PMUCTRState *counter =3D &env->pmu_ctrs[ctr_idx]; uint64_t mhpmctr_val =3D val; + bool instr =3D riscv_pmu_ctr_monitor_instructions(env, ctr_idx); =20 counter->mhpmcounter_val =3D val; - if (riscv_pmu_ctr_monitor_cycles(env, ctr_idx) || - riscv_pmu_ctr_monitor_instructions(env, ctr_idx)) { - counter->mhpmcounter_prev =3D get_ticks(false); + if (riscv_pmu_ctr_monitor_cycles(env, ctr_idx) || instr) { + counter->mhpmcounter_prev =3D get_ticks(false, instr); if (ctr_idx > 2) { if (riscv_cpu_mxl(env) =3D=3D MXL_RV32) { mhpmctr_val =3D mhpmctr_val | @@ -902,12 +906,12 @@ static RISCVException write_mhpmcounterh(CPURISCVStat= e *env, int csrno, PMUCTRState *counter =3D &env->pmu_ctrs[ctr_idx]; uint64_t mhpmctr_val =3D counter->mhpmcounter_val; uint64_t mhpmctrh_val =3D val; + bool instr =3D riscv_pmu_ctr_monitor_instructions(env, ctr_idx); =20 counter->mhpmcounterh_val =3D val; mhpmctr_val =3D mhpmctr_val | (mhpmctrh_val << 32); - if (riscv_pmu_ctr_monitor_cycles(env, ctr_idx) || - riscv_pmu_ctr_monitor_instructions(env, ctr_idx)) { - counter->mhpmcounterh_prev =3D get_ticks(true); + if (riscv_pmu_ctr_monitor_cycles(env, ctr_idx) || instr) { + counter->mhpmcounterh_prev =3D get_ticks(true, instr); if (ctr_idx > 2) { riscv_pmu_setup_timer(env, mhpmctr_val, ctr_idx); } @@ -926,6 +930,7 @@ static RISCVException riscv_pmu_read_ctr(CPURISCVState = *env, target_ulong *val, counter->mhpmcounter_prev; target_ulong ctr_val =3D upper_half ? counter->mhpmcounterh_val : counter->mhpmcounter_val; + bool instr =3D riscv_pmu_ctr_monitor_instructions(env, ctr_idx); =20 if (get_field(env->mcountinhibit, BIT(ctr_idx))) { /* @@ -946,9 +951,8 @@ static RISCVException riscv_pmu_read_ctr(CPURISCVState = *env, target_ulong *val, * The kernel computes the perf delta by subtracting the current value= from * the value it initialized previously (ctr_val). */ - if (riscv_pmu_ctr_monitor_cycles(env, ctr_idx) || - riscv_pmu_ctr_monitor_instructions(env, ctr_idx)) { - *val =3D get_ticks(upper_half) - ctr_prev + ctr_val; + if (riscv_pmu_ctr_monitor_cycles(env, ctr_idx) || instr) { + *val =3D get_ticks(upper_half, instr) - ctr_prev + ctr_val; } else { *val =3D ctr_val; } --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482764; cv=none; d=zohomail.com; s=zohoarc; b=Dl07d/Ax5NOdsyunTAqyFX0nileyHziXZ7qepeZWsAq0m3oDjdDjmWtCczG/kma0hbKFU9+1zNSMMRdfuUQfKNWMQmh1zOE1QuYAQ8GgSto844+8IqDnpCTn88JKMlj7PrFIsBMr8vR6HvFhuS8nNJHg2tM0LhQZPmGc5mYrxU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482764; 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=YnkZtfqlRk/cYHVUB0haBca2EsSvWjX5ehFS1hvQupE=; b=JCYyRS6zeCAlg+MpYGbqxTMJGiLx43V95QxnnUzOBYSQzbe1+MQzCI6j7KPneNydd4F1LLvfsgr/L13oyp5hH8UIm5Xg17T+xc93l8A0aDoomhCG71/nJG0I6xAv+75EJFw2+EGgjnlrs3HtNSy+GtqVG11FSXLrUM83w6dWOQM= 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 1719482764879727.686795299674; Thu, 27 Jun 2024 03:06:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxn-0007hX-5Q; Thu, 27 Jun 2024 06:02: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 1sMlxT-00070H-H9 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:33 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxQ-00022t-Rk for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:26 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-7041053c0fdso4624082b3a.3 for ; Thu, 27 Jun 2024 03:02:23 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482542; x=1720087342; 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=YnkZtfqlRk/cYHVUB0haBca2EsSvWjX5ehFS1hvQupE=; b=arWaMsBL3wFg8+1rwIXSUYSu2QiUFRni47qxhMDtiMruSumKZU2LpgSrnTfMCiv5Ra AVPPJIcYLnSKcQxmi7eDvFcC6r+6wqBhUq4zy1bLFpl6xgHiSCItZpcxL+IKu+nKcHm0 fmeSqvSKSk/SVeRJlVCUkQpQgF2aFdx14FOoY7grUYStaBsIgvIYqGOUpZZ9YhLQKO4Q 4s37aUP9ZMxDh+IoEghLdO3Mg4qcX+REkizcC4kqM+O9h6GUIkYvFnPas0BBkBSzSywb yNK7sllTGheHzlpseJTlz8S7XFtDNBmkI0dnrURd7toZ/z9WsUb5iMWb2g9gEHdLIIcT 7CNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482542; x=1720087342; 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=YnkZtfqlRk/cYHVUB0haBca2EsSvWjX5ehFS1hvQupE=; b=M4HDkAyGP4cDOf6BZbp6rsjYasa3x5XwVssRWa2NP8SK1TL0cU/rJm8mtxIfPFCjlw 6GBT+em/r8YWhjbldyuu2YMIyLcViLi30IAvu8sh9JttGohn7r9skIxdYMinPXp23GaC xgoTnoB2qo3d0Tflwe1WEGDAwnIIn3XzHz6G6RlvkRoeJPaQzsTN+kdzUp+dcrGGxypB RzPRNUNRiPE9XnkDUSgHlOlQ3QJFBfWGeiRw7WHpZNhQKl1DnQQJPjnkKOTN6R2P7wV/ tCl+FeFm4X38QJElWKu1HcqJwpDaL45xb9h4spQy3mKIZixpGj3BC42BpFOv6UvLdvzR Fofw== X-Gm-Message-State: AOJu0YwnbcJUb5OLmd1F+eJEelCCy6bjw87KC1lwxoRZW0jidmnJdGys X9UvE8s9qRNQJRlMj51PowRVJatwXJyFxndYCDiCSz4nOkqBdyQe0eupvHWs X-Google-Smtp-Source: AGHT+IHUFnWvX+Z7yhzkGn8VfG/zDNOZvrKxs1fwaNoPM1fq6R0o8wZHu226DvUYRVYEwYcQias+BQ== X-Received: by 2002:aa7:8f8f:0:b0:706:b19c:46cf with SMTP id d2e1a72fcca58-706b19c4a75mr2201839b3a.20.1719482542055; Thu, 27 Jun 2024 03:02:22 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Frank Chang , Jerry Zhang Jian , Max Chou , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 24/32] target/riscv: Introduce extension implied rules definition Date: Thu, 27 Jun 2024 20:00:45 +1000 Message-ID: <20240627100053.150937-25-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::435; envelope-from=alistair23@gmail.com; helo=mail-pf1-x435.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482765834100001 Content-Type: text/plain; charset="utf-8" From: Frank Chang RISCVCPUImpliedExtsRule is created to store the implied rules. 'is_misa' flag is used to distinguish whether the rule is derived from the MISA or other extensions. 'ext' stores the MISA bit if 'is_misa' is true. Otherwise, it stores the offset of the extension defined in RISCVCPUConfig. 'ext' will also serve as the key of the hash tables to look up the rule in the following commit. Signed-off-by: Frank Chang Reviewed-by: Jerry Zhang Jian Tested-by: Max Chou Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20240625114629.27793-2-frank.chang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.h | 23 +++++++++++++++++++++++ target/riscv/cpu.c | 8 ++++++++ 2 files changed, 31 insertions(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 90b8f1b08f..87742047ce 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -124,6 +124,29 @@ typedef enum { EXT_STATUS_DIRTY, } RISCVExtStatus; =20 +typedef struct riscv_cpu_implied_exts_rule { +#ifndef CONFIG_USER_ONLY + /* + * Bitmask indicates the rule enabled status for the harts. + * This enhancement is only available in system-mode QEMU, + * as we don't have a good way (e.g. mhartid) to distinguish + * the SMP cores in user-mode QEMU. + */ + unsigned long *enabled; +#endif + /* True if this is a MISA implied rule. */ + bool is_misa; + /* ext is MISA bit if is_misa flag is true, else multi extension offse= t. */ + const uint32_t ext; + const uint32_t implied_misa_exts; + const uint32_t implied_multi_exts[]; +} RISCVCPUImpliedExtsRule; + +extern RISCVCPUImpliedExtsRule *riscv_misa_ext_implied_rules[]; +extern RISCVCPUImpliedExtsRule *riscv_multi_ext_implied_rules[]; + +#define RISCV_IMPLIED_EXTS_RULE_END -1 + #define MMU_USER_IDX 3 =20 #define MAX_RISCV_PMPS (16) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 4760cb2cc1..7b071ade04 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2250,6 +2250,14 @@ RISCVCPUProfile *riscv_profiles[] =3D { NULL, }; =20 +RISCVCPUImpliedExtsRule *riscv_misa_ext_implied_rules[] =3D { + NULL +}; + +RISCVCPUImpliedExtsRule *riscv_multi_ext_implied_rules[] =3D { + NULL +}; + static Property riscv_cpu_properties[] =3D { DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true), =20 --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482695; cv=none; d=zohomail.com; s=zohoarc; b=E4wlHHpTlymDOlqDTt31p0+eAkOel3CVETLnHhImHaNeyG3GiODNseA1s3rVYijGaE+cZHHoio8O72CAAcH552IrkZxlf1BIhXuOgu/vVKV5aSNNhkZwRy2bwb7FZquzVMAiQcpP2ZcYTyDNmvyzyqn4EGK3Ycq120x7BlpVoCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482695; 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=OSFAAtkK04aUf0dxdh06bjVR315nH132+u1Sn1Pe3ZU=; b=nZXbG8GvE1F18sm4gsIX4UPK04aZebxbxGxgKvzzO8KgDpHP0oe8m0t98iQsP//N2dwZwH9gsl3UP5GwJYnwnJfqEXBpfU9lS3YUtpzIX/G1slNoVew22Owuj7Nj5ZxJDZYIdJebRp0YZqzd9qaCVn5/Qi278ii1ui83G/kszuw= 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 1719482695785716.0161370507765; Thu, 27 Jun 2024 03:04:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxl-0007U8-EO; Thu, 27 Jun 2024 06:02:45 -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 1sMlxX-00073Q-Bi for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:33 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxU-00029E-EF for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:30 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-7041053c0fdso4624129b3a.3 for ; Thu, 27 Jun 2024 03:02:27 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482546; x=1720087346; 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=OSFAAtkK04aUf0dxdh06bjVR315nH132+u1Sn1Pe3ZU=; b=VZdiLPZ7xdVbAcMocFvXmjmt98lhVH7VB4Ez5DET8fS97evr2TgeyedHdYsBjM2ROj kL0eSfKi/QsbFAFyQFSa7pxZrO6pqwjwF6ZUVbgOvJnhDlV23+UOolHX6GrbDLk17v3W wbQ4CN6deYHnrY3ISyuFZtsgHYdShTsxNxU7un793wQaGxJL+xaGF/et/VakRFmhnN91 IS8/bRYoAcMERayfXV+AAkHK8/SdaMeLaEGhlsdqhpwqHKfdrvnCfIae3JBtHIuNq0MG iwEpDxwmWj6pvQfvblp/qIjBiM88CP3GRjviqfRNA/ZL9GpaGrLzgEB1PGblIn25OPI5 PFmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482546; x=1720087346; 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=OSFAAtkK04aUf0dxdh06bjVR315nH132+u1Sn1Pe3ZU=; b=G3OywOD///UZWDt9KnO/BQ8HNNZkN4mKt+IjO7vgkKzpHYtebeQcnMvv9SMToqJXiX 3OrkdNOpWlvzG9DZ0M3eRaEIHPKRly3KQR+5SIj02K+g/LagAQh19vmCAv2g9OYN//ud aM1anostwGS0b4YXWFNpVuDgpIIFXVLJ8BXnp4zGu5jLJvRrrECz6fKt4Tcg7r1qjTdX Ti34F6X2y2xr5iV2aiamP4eTq9pJdhVX1P5DUvaBgRUYZPsEhoiAqECDP9kKs2scyOtU fe0Fv+9n6WC0ovWWlFPz/LJTsm2UNjH+VbW7be3CmXjV4D1ICvERth5EsLd5kSgbLSqt xcHg== X-Gm-Message-State: AOJu0YyNWdqXs4YYKNar+a6AZp8ftqrED+VozDa0Hqm34GiVhOlP9Qa7 HGIRzqZ89z1kp4LiOw3ws+Dxr8SK0UiVXnysmoAqKsGnKq4OTyDLPcpPgp/q X-Google-Smtp-Source: AGHT+IHyoOLGVL3sT60nT6pbfROBT3jUwBAEqpogpcc9ozdxI9JIqMG1m7nplZiwhF+KfR3/4nKyLw== X-Received: by 2002:aa7:8614:0:b0:706:73bc:50b7 with SMTP id d2e1a72fcca58-706745b42fdmr11789387b3a.16.1719482545664; Thu, 27 Jun 2024 03:02:25 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Frank Chang , Jerry Zhang Jian , Max Chou , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 25/32] target/riscv: Introduce extension implied rule helpers Date: Thu, 27 Jun 2024 20:00:46 +1000 Message-ID: <20240627100053.150937-26-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::436; envelope-from=alistair23@gmail.com; helo=mail-pf1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482697581100005 Content-Type: text/plain; charset="utf-8" From: Frank Chang Introduce helpers to enable the extensions based on the implied rules. The implied extensions are enabled recursively, so we don't have to expand all of them manually. This also eliminates the old-fashioned ordering requirement. For example, Zvksg implies Zvks, Zvks implies Zvksed, etc., removing the need to check the implied rules of Zvksg before Zvks. Signed-off-by: Frank Chang Reviewed-by: Jerry Zhang Jian Tested-by: Max Chou Reviewed-by: Daniel Henrique Barboza Message-ID: <20240625114629.27793-3-frank.chang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/tcg/tcg-cpu.c | 121 +++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index eb6f7b9d12..1a3aef5bff 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -31,11 +31,17 @@ #include "hw/core/accel-cpu.h" #include "hw/core/tcg-cpu-ops.h" #include "tcg/tcg.h" +#ifndef CONFIG_USER_ONLY +#include "hw/boards.h" +#endif =20 /* Hash that stores user set extensions */ static GHashTable *multi_ext_user_opts; static GHashTable *misa_ext_user_opts; =20 +static GHashTable *multi_ext_implied_rules; +static GHashTable *misa_ext_implied_rules; + static bool cpu_cfg_ext_is_user_set(uint32_t ext_offset) { return g_hash_table_contains(multi_ext_user_opts, @@ -836,11 +842,117 @@ static void riscv_cpu_validate_profiles(RISCVCPU *cp= u) } } =20 +static void riscv_cpu_init_implied_exts_rules(void) +{ + RISCVCPUImpliedExtsRule *rule; +#ifndef CONFIG_USER_ONLY + MachineState *ms =3D MACHINE(qdev_get_machine()); +#endif + static bool initialized; + int i; + + /* Implied rules only need to be initialized once. */ + if (initialized) { + return; + } + + for (i =3D 0; (rule =3D riscv_misa_ext_implied_rules[i]); i++) { +#ifndef CONFIG_USER_ONLY + rule->enabled =3D bitmap_new(ms->smp.cpus); +#endif + g_hash_table_insert(misa_ext_implied_rules, + GUINT_TO_POINTER(rule->ext), (gpointer)rule); + } + + for (i =3D 0; (rule =3D riscv_multi_ext_implied_rules[i]); i++) { +#ifndef CONFIG_USER_ONLY + rule->enabled =3D bitmap_new(ms->smp.cpus); +#endif + g_hash_table_insert(multi_ext_implied_rules, + GUINT_TO_POINTER(rule->ext), (gpointer)rule); + } + + initialized =3D true; +} + +static void cpu_enable_implied_rule(RISCVCPU *cpu, + RISCVCPUImpliedExtsRule *rule) +{ + CPURISCVState *env =3D &cpu->env; + RISCVCPUImpliedExtsRule *ir; + bool enabled =3D false; + int i; + +#ifndef CONFIG_USER_ONLY + enabled =3D test_bit(cpu->env.mhartid, rule->enabled); +#endif + + if (!enabled) { + /* Enable the implied MISAs. */ + if (rule->implied_misa_exts) { + riscv_cpu_set_misa_ext(env, + env->misa_ext | rule->implied_misa_exts= ); + + for (i =3D 0; misa_bits[i] !=3D 0; i++) { + if (rule->implied_misa_exts & misa_bits[i]) { + ir =3D g_hash_table_lookup(misa_ext_implied_rules, + GUINT_TO_POINTER(misa_bits[i]= )); + + if (ir) { + cpu_enable_implied_rule(cpu, ir); + } + } + } + } + + /* Enable the implied extensions. */ + for (i =3D 0; + rule->implied_multi_exts[i] !=3D RISCV_IMPLIED_EXTS_RULE_END;= i++) { + cpu_cfg_ext_auto_update(cpu, rule->implied_multi_exts[i], true= ); + + ir =3D g_hash_table_lookup(multi_ext_implied_rules, + GUINT_TO_POINTER( + rule->implied_multi_exts[i])); + + if (ir) { + cpu_enable_implied_rule(cpu, ir); + } + } + +#ifndef CONFIG_USER_ONLY + bitmap_set(rule->enabled, cpu->env.mhartid, 1); +#endif + } +} + +static void riscv_cpu_enable_implied_rules(RISCVCPU *cpu) +{ + RISCVCPUImpliedExtsRule *rule; + int i; + + /* Enable the implied MISAs. */ + for (i =3D 0; (rule =3D riscv_misa_ext_implied_rules[i]); i++) { + if (riscv_has_ext(&cpu->env, rule->ext)) { + cpu_enable_implied_rule(cpu, rule); + } + } + + /* Enable the implied extensions. */ + for (i =3D 0; (rule =3D riscv_multi_ext_implied_rules[i]); i++) { + if (isa_ext_is_enabled(cpu, rule->ext)) { + cpu_enable_implied_rule(cpu, rule); + } + } +} + void riscv_tcg_cpu_finalize_features(RISCVCPU *cpu, Error **errp) { CPURISCVState *env =3D &cpu->env; Error *local_err =3D NULL; =20 + riscv_cpu_init_implied_exts_rules(); + riscv_cpu_enable_implied_rules(cpu); + riscv_cpu_validate_misa_priv(env, &local_err); if (local_err !=3D NULL) { error_propagate(errp, local_err); @@ -1346,6 +1458,15 @@ static void riscv_tcg_cpu_instance_init(CPUState *cs) =20 misa_ext_user_opts =3D g_hash_table_new(NULL, g_direct_equal); multi_ext_user_opts =3D g_hash_table_new(NULL, g_direct_equal); + + if (!misa_ext_implied_rules) { + misa_ext_implied_rules =3D g_hash_table_new(NULL, g_direct_equal); + } + + if (!multi_ext_implied_rules) { + multi_ext_implied_rules =3D g_hash_table_new(NULL, g_direct_equal); + } + riscv_cpu_add_user_properties(obj); =20 if (riscv_cpu_has_max_extensions(obj)) { --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482668; cv=none; d=zohomail.com; s=zohoarc; b=Ro5mRNvzLHV5LaGwJvHEogTiUL2M7w5SM30ThATaROAsC4jYH7wkEEH6Wm+dvspbmrMEP5VtsU0uy5qq3qlRe5UvZ6eWcTmUsFKKlI0rtV2q50kurwfqGstlCE+iJuRAF0+YfaUdeUxY/uklgYbmrLBtrOlzP38Od2WChc9jG6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482668; 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=AnEaxExSxNmbwr/9W4/pvVWPb9oM7FgPkjyis6ytKNc=; b=QP4mtg/YmkjshXcmawwU56xarW/ZWrLJkxhRo+FwN2Fh5Urv/4Z2wudPhzO5PAjRQs5KRAEAXXxRSBYsFumvZIRbfB+wxeadlmamlmWJwRPMmMXrerTxdwL6q/MBRZJpvjgBSFWwT+7nDjh9u1L7z8XZnD2W1PBn9Io8l4A0akM= 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 1719482668428643.6830639091143; Thu, 27 Jun 2024 03:04:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxk-0007Mu-7U; Thu, 27 Jun 2024 06:02:44 -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 1sMlxY-00073c-Oa for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:33 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxX-0002Db-3g for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:32 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-70679845d69so3371140b3a.1 for ; Thu, 27 Jun 2024 03:02:30 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482549; x=1720087349; 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=AnEaxExSxNmbwr/9W4/pvVWPb9oM7FgPkjyis6ytKNc=; b=biI5mAMqkRWZaNfd1jCBIwTbacjhZUhpR6QZFwSUaxxo6WHX2v8kVoVtTRl7NstTZd gVs9PhFSywjWjIsZ7YFmoocjWFsrGAGPMo7tajPWIXDVFE/hk3vZlZ0OWguQmY1Svbvj N1sWsQKPXWvwaBXbr0O8qu7PeL+H5G5/KCB6adzb6crrV9iidQWlCeftolMtsOZBVgOF M6zvGJe3GJ2F3IaaXYuBxmPcvaqh00vPJP6sz2AWK9O9RfnViiQ/0DBoSgM+EyJHfqpz bYq59I+JTWK0lN6BR0bN5734ke/LJBJPR0K6/GyhsfOLC6hDM33x/KwSrIM1jsuiXiKN AgIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482549; x=1720087349; 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=AnEaxExSxNmbwr/9W4/pvVWPb9oM7FgPkjyis6ytKNc=; b=Pyh5MrdDzQS23exAuAKh2WsYyWABpiNW96PxkMZc9xM+tmny3LEAFLAfRhZnOLgPLE sIFQQOjj58M8UI/vQ+KN+cHrEcnFomfWJo0IACnfetOULP2i3q5TYkJSvIVU5BJ0af6O vtdzB32VbiXbdzkxnmi9enpW18M6B7ELoEBuDNjVQaWp4lMqQpTzKJOsG5ImzASMSNpE aP/pYh9DD8tDTAX3qOZsPuPUaVRNCeGgZo2wLJxsut4miP98dYt+Y5lePTvWhuEwmp/W jf7F6WTSHpYJgCGH3WN7pt27TL4RVbZ3k5Nk20QRaxi3Zo6fXD56vQEdUrdcPI19aU+t L3Kg== X-Gm-Message-State: AOJu0YwANfCzHw8gg1iam8QY+Rx9DDSzlrdJxI+2ce3vsU5TdFmwqJmv 316XgPLpftrWbwyIyfjdTEgKOCF4sZjdVXA0TVe0dT3d3ujL8IPvF8D1ubmH X-Google-Smtp-Source: AGHT+IHtqf5Txsppm8q8DMszDbNclDzwwb1/Hc2PWeJNHIaTPYrKAIPIU/AD7wgGseGslDKWqnAPOA== X-Received: by 2002:aa7:8611:0:b0:706:375e:220d with SMTP id d2e1a72fcca58-706746fa56cmr12021869b3a.30.1719482549185; Thu, 27 Jun 2024 03:02:29 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Frank Chang , Jerry Zhang Jian , Max Chou , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 26/32] target/riscv: Add MISA extension implied rules Date: Thu, 27 Jun 2024 20:00:47 +1000 Message-ID: <20240627100053.150937-27-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::434; envelope-from=alistair23@gmail.com; helo=mail-pf1-x434.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482669411100001 Content-Type: text/plain; charset="utf-8" From: Frank Chang Add MISA extension implied rules to enable the implied extensions of MISA recursively. Signed-off-by: Frank Chang Reviewed-by: Jerry Zhang Jian Tested-by: Max Chou Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-ID: <20240625114629.27793-4-frank.chang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 50 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 7b071ade04..b463bd8370 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2250,8 +2250,56 @@ RISCVCPUProfile *riscv_profiles[] =3D { NULL, }; =20 +static RISCVCPUImpliedExtsRule RVA_IMPLIED =3D { + .is_misa =3D true, + .ext =3D RVA, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zalrsc), CPU_CFG_OFFSET(ext_zaamo), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule RVD_IMPLIED =3D { + .is_misa =3D true, + .ext =3D RVD, + .implied_misa_exts =3D RVF, + .implied_multi_exts =3D { RISCV_IMPLIED_EXTS_RULE_END }, +}; + +static RISCVCPUImpliedExtsRule RVF_IMPLIED =3D { + .is_misa =3D true, + .ext =3D RVF, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zicsr), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule RVM_IMPLIED =3D { + .is_misa =3D true, + .ext =3D RVM, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zmmul), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule RVV_IMPLIED =3D { + .is_misa =3D true, + .ext =3D RVV, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve64d), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + RISCVCPUImpliedExtsRule *riscv_misa_ext_implied_rules[] =3D { - NULL + &RVA_IMPLIED, &RVD_IMPLIED, &RVF_IMPLIED, + &RVM_IMPLIED, &RVV_IMPLIED, NULL }; =20 RISCVCPUImpliedExtsRule *riscv_multi_ext_implied_rules[] =3D { --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482584; cv=none; d=zohomail.com; s=zohoarc; b=BsxK62vMIv8H4otxQS7BL0azn8BnPNgRga3cJ7y0ZvOiXn8ULAj9yAdCiJDYwm8n6kNTwOBtgZ60QIkOeRiiITtvg/iX5VzSnowg4sUZj/DJ6wili6+JNMwCoUlTE35ppLJ0Z6vUF2zmW4XyWaI4HgvPDl7AuD4WPdwS87rrklg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482584; 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=+3b4i1MebHelO8I9kGEWGTWysdpA0laU5VjzsEYbS4w=; b=f+pKbqV1U6p8goeHGU7ot0osJ5wrHFwmAoVWyRJs9g/hqdjnvPFLlrtM55iP2YwDG8NVV5Md3FvFlWEob30FBmUmxvU8ewBU3UvlTvXI11WyosgOCgp0FUF1yjCJpe5DSsLVxA+dLl/rHQeNlHthcLUUzvaXQZ/C1DHhyo4cvPU= 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 1719482584117189.68538885518012; Thu, 27 Jun 2024 03:03:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxk-0007P1-IZ; Thu, 27 Jun 2024 06:02:44 -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 1sMlxg-00078J-T9 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:42 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxb-0002LB-LK for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:40 -0400 Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-7f38f5584ebso294339039f.3 for ; Thu, 27 Jun 2024 03:02:35 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482553; x=1720087353; 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=+3b4i1MebHelO8I9kGEWGTWysdpA0laU5VjzsEYbS4w=; b=jikOLZxx11Q3QYE6zxTh/d2Cfb5nSpxUIjMHfuPQr1u1w5AZnIIj4qPiQ8503db6Td Sx+t1sbVz3OBzvJm9fyBLJ5MQ7RNfySyyapa+DJRnikECsgCN3TaApRGNN1jXBEerUK1 2izAEPWkJ/f2gNffXwmVdrAEUGHaUQmAP+Qf898pYPf3NwSD7wE2EjB8c7l91n+/Ub4u scfxPH+X+dgQBAkde+pZOzoDwNQUQntwGfFybQlPFFSsh1wJLObFViga1qNhwKwjplCr s1twZW9qrfRPObcKDcxroOX6RgBso+GbJ4mrcn95cOpOIlfBuGyNpNwzagrCxx1KlVyO 3Lyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482553; x=1720087353; 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=+3b4i1MebHelO8I9kGEWGTWysdpA0laU5VjzsEYbS4w=; b=FWgP4xOwVmuTpQmrrtZHvw68kxkQe7R1Hk7pTAw9S7t6Efg14e5OMe//38IdvOVekW 46Zwi3zYFkjHhbE+56i/5kyX2pzLyEBt0rEYBhLY6gPCluutQG84rCgOIDiK9uyufM0Y VBTu9gCGYIMGodzAEYGrpieWUEZ7cCNgP24Sp29z/WWFPuUp4p+EOv+rW/F/Qhi7CKLd CTx91vKomsUn2i0VoQ6uWvgcK3oBfPgokTfbaMn+14PuMXmDWUqZml8J9IuGmW5a1l4u FD9dy0LzBpuIv+Ce2ZZ1KzHjhUMgrwsD4zTVTwDDjk1xrxX41Lx3k2ofYmmzoOSXBgOT svpA== X-Gm-Message-State: AOJu0YyQP8ZNIgu34zFvBcQ8Ru+Jqib7RxAhLA9BIFffBJbCQCxCTo/B 8Ey70mXYnVwg61ckB4GeL0tZZBc5z3pjjOdoOxBmi7uYV9Hetv72LVGx7ZSh X-Google-Smtp-Source: AGHT+IHVhTDcL4fZw0QdopDpSTnzN6sCGIUt84GQR18fIeKROJAC4knWU00AewUDkSIni8CttZijCg== X-Received: by 2002:a05:6602:2d82:b0:7eb:8a6e:11e1 with SMTP id ca18e2360f4ac-7f3a4dc2c31mr1765560839f.5.1719482552823; Thu, 27 Jun 2024 03:02:32 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Frank Chang , Jerry Zhang Jian , Max Chou , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 27/32] target/riscv: Add multi extension implied rules Date: Thu, 27 Jun 2024 20:00:48 +1000 Message-ID: <20240627100053.150937-28-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::d33; envelope-from=alistair23@gmail.com; helo=mail-io1-xd33.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, UPPERCASE_50_75=0.008 autolearn=no 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: 1719482585032100002 Content-Type: text/plain; charset="utf-8" From: Frank Chang Add multi extension implied rules to enable the implied extensions of the multi extension recursively. Signed-off-by: Frank Chang Reviewed-by: Jerry Zhang Jian Tested-by: Max Chou Acked-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-ID: <20240625114629.27793-5-frank.chang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 340 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 340 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index b463bd8370..a2640cf259 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2297,12 +2297,352 @@ static RISCVCPUImpliedExtsRule RVV_IMPLIED =3D { }, }; =20 +static RISCVCPUImpliedExtsRule ZCB_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zcb), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zca), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZCD_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zcd), + .implied_misa_exts =3D RVD, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zca), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZCE_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zce), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zcb), CPU_CFG_OFFSET(ext_zcmp), + CPU_CFG_OFFSET(ext_zcmt), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZCF_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zcf), + .implied_misa_exts =3D RVF, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zca), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZCMP_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zcmp), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zca), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZCMT_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zcmt), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zca), CPU_CFG_OFFSET(ext_zicsr), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZDINX_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zdinx), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zfinx), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZFA_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zfa), + .implied_misa_exts =3D RVF, + .implied_multi_exts =3D { RISCV_IMPLIED_EXTS_RULE_END }, +}; + +static RISCVCPUImpliedExtsRule ZFBFMIN_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zfbfmin), + .implied_misa_exts =3D RVF, + .implied_multi_exts =3D { RISCV_IMPLIED_EXTS_RULE_END }, +}; + +static RISCVCPUImpliedExtsRule ZFH_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zfh), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zfhmin), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZFHMIN_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zfhmin), + .implied_misa_exts =3D RVF, + .implied_multi_exts =3D { RISCV_IMPLIED_EXTS_RULE_END }, +}; + +static RISCVCPUImpliedExtsRule ZFINX_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zfinx), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zicsr), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZHINX_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zhinx), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zhinxmin), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZHINXMIN_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zhinxmin), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zfinx), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZICNTR_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zicntr), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zicsr), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZIHPM_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zihpm), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zicsr), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZK_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zk), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zkn), CPU_CFG_OFFSET(ext_zkr), + CPU_CFG_OFFSET(ext_zkt), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZKN_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zkn), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zbkb), CPU_CFG_OFFSET(ext_zbkc), + CPU_CFG_OFFSET(ext_zbkx), CPU_CFG_OFFSET(ext_zkne), + CPU_CFG_OFFSET(ext_zknd), CPU_CFG_OFFSET(ext_zknh), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZKS_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zks), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zbkb), CPU_CFG_OFFSET(ext_zbkc), + CPU_CFG_OFFSET(ext_zbkx), CPU_CFG_OFFSET(ext_zksed), + CPU_CFG_OFFSET(ext_zksh), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVBB_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvbb), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvkb), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVE32F_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zve32f), + .implied_misa_exts =3D RVF, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve32x), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVE32X_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zve32x), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zicsr), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVE64D_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zve64d), + .implied_misa_exts =3D RVD, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve64f), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVE64F_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zve64f), + .implied_misa_exts =3D RVF, + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve32f), CPU_CFG_OFFSET(ext_zve64x), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVE64X_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zve64x), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve32x), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVFBFMIN_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvfbfmin), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve32f), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVFBFWMA_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvfbfwma), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvfbfmin), CPU_CFG_OFFSET(ext_zfbfmin), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVFH_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvfh), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvfhmin), CPU_CFG_OFFSET(ext_zfhmin), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVFHMIN_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvfhmin), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve32f), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVKN_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvkn), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvkned), CPU_CFG_OFFSET(ext_zvknhb), + CPU_CFG_OFFSET(ext_zvkb), CPU_CFG_OFFSET(ext_zvkt), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVKNC_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvknc), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvkn), CPU_CFG_OFFSET(ext_zvbc), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVKNG_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvkng), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvkn), CPU_CFG_OFFSET(ext_zvkg), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVKNHB_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvknhb), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zve64x), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVKS_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvks), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvksed), CPU_CFG_OFFSET(ext_zvksh), + CPU_CFG_OFFSET(ext_zvkb), CPU_CFG_OFFSET(ext_zvkt), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVKSC_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvksc), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvks), CPU_CFG_OFFSET(ext_zvbc), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + +static RISCVCPUImpliedExtsRule ZVKSG_IMPLIED =3D { + .ext =3D CPU_CFG_OFFSET(ext_zvksg), + .implied_multi_exts =3D { + CPU_CFG_OFFSET(ext_zvks), CPU_CFG_OFFSET(ext_zvkg), + + RISCV_IMPLIED_EXTS_RULE_END + }, +}; + RISCVCPUImpliedExtsRule *riscv_misa_ext_implied_rules[] =3D { &RVA_IMPLIED, &RVD_IMPLIED, &RVF_IMPLIED, &RVM_IMPLIED, &RVV_IMPLIED, NULL }; =20 RISCVCPUImpliedExtsRule *riscv_multi_ext_implied_rules[] =3D { + &ZCB_IMPLIED, &ZCD_IMPLIED, &ZCE_IMPLIED, + &ZCF_IMPLIED, &ZCMP_IMPLIED, &ZCMT_IMPLIED, + &ZDINX_IMPLIED, &ZFA_IMPLIED, &ZFBFMIN_IMPLIED, + &ZFH_IMPLIED, &ZFHMIN_IMPLIED, &ZFINX_IMPLIED, + &ZHINX_IMPLIED, &ZHINXMIN_IMPLIED, &ZICNTR_IMPLIED, + &ZIHPM_IMPLIED, &ZK_IMPLIED, &ZKN_IMPLIED, + &ZKS_IMPLIED, &ZVBB_IMPLIED, &ZVE32F_IMPLIED, + &ZVE32X_IMPLIED, &ZVE64D_IMPLIED, &ZVE64F_IMPLIED, + &ZVE64X_IMPLIED, &ZVFBFMIN_IMPLIED, &ZVFBFWMA_IMPLIED, + &ZVFH_IMPLIED, &ZVFHMIN_IMPLIED, &ZVKN_IMPLIED, + &ZVKNC_IMPLIED, &ZVKNG_IMPLIED, &ZVKNHB_IMPLIED, + &ZVKS_IMPLIED, &ZVKSC_IMPLIED, &ZVKSG_IMPLIED, NULL }; =20 --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482734; cv=none; d=zohomail.com; s=zohoarc; b=bM++yjIcM4Ymdm/O83goeosUO7gehQvspFn6sussuglsHSGvcCLZmcp7oCFSXU92cUrtFckj4FSt8qfjTBRVqWh7iMRCgWyzNZr/Tkc8PjgKWIau0M+8oWE1V1Vac+pqL4seygpjhxNMoS503YKdAxc4qe2YxB7/8OVLpYDJ41Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482734; 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=tedPVH5tOOaMJ1rcUzWl+rZdz35T4y32JngaUuhBL4k=; b=TFD4ugmeJXcrFQ4LzY6CWoDFzqMp+qSeBYYLEPJNZfegMjKqh/ePr0sibgY+0oAxryDyQ4bMckNenng84FxKfHimooc1oa7mliEffilFm5AYYmgzfy+mLYCzxHijCyH7j/FNoaWyjSBIlJWX1EGzDjb6NyfILOViTpr0a98S9Ok= 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 17194827346451003.4701990871029; Thu, 27 Jun 2024 03:05:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxn-0007qS-VK; Thu, 27 Jun 2024 06:02:48 -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 1sMlxh-00078K-Le for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:43 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxe-0002VI-9T for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:40 -0400 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3d5654d5f4fso597833b6e.1 for ; Thu, 27 Jun 2024 03:02:37 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482556; x=1720087356; 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=tedPVH5tOOaMJ1rcUzWl+rZdz35T4y32JngaUuhBL4k=; b=P7R2koOFxVOjjg4BayZjS9cDt0npyvyNaII80UHOl3GOzbb/YMMoEzVGjiuVan+ndC l9dtg0qKHrjxCeIPKcR4FZMNxkpTkCbJKxZF3rs77rfUZwPtyI7ATNjuUKw8SDB2PD75 L2Cuh7Tywdm/T5fvj0+lA/VWGwv/Xr0v4sKDaFzE6/31C04R4i8YYeQ4d7uEoL7kZrXf C4EnKuPg+R0X5clL6PxyiWuEqe9qeexSe4r9NW0SQ8rWR4ykDYt8w3NBX3FxQniqYnK/ npEe03EMYBkszHTOkNn6Cw20+Pnctft6LRUE1De5g5r1J2Lbevpt9s2Rq4FcrSJsd3CI DSiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482556; x=1720087356; 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=tedPVH5tOOaMJ1rcUzWl+rZdz35T4y32JngaUuhBL4k=; b=w/WrOJnTmjnSsCwJpQJlc/eS1XD1LMFm+XTObVxiQ28q1jJjIpbnEc09gC6UBGuWqg RKOWvxjPQBcAqQr76lnG7MGgbG6+TUJi4yG9adPztFt+j+jZ1DeoPcraKfehawaT/LTf GRvBlBEhbpU5I25Nwkpb1NmjZsLtCugCRvutAbXWHzqwXfT+x3V2UriWuMDkRWTzTAiy mPr9xXa17zTdv/fU4G6JBdsnFCYXuzOM4jmxFkpfII5eH74wyF8vDypCN09Mm4zZzwNS tYqAcBLrQN1AL+3MdYNF21anUYVlrHT9Uyu0BgauGNfRFwCIq4TiNlSb01JJjhSlU/Mf 4guA== X-Gm-Message-State: AOJu0YzY3Hh0MetH11AxYAWxkqECET50RrC355IrMmgudVqOqlXoxa1b Sj4uRvzrwnzwsyGna6G/sGKB9BM/ZD5qkyLWizSSGImZIsMOikt0fPKWhQBN X-Google-Smtp-Source: AGHT+IH+5rS9Z2R3xEdnXY4nMw8/TguA/29gryFOXrx0HPDbcqXM7uctFFqv/K7BgM06kS2uxjsTgg== X-Received: by 2002:a05:6870:8183:b0:25d:921:75ec with SMTP id 586e51a60fabf-25d0921ad16mr13707220fac.36.1719482556416; Thu, 27 Jun 2024 03:02:36 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Frank Chang , Jerry Zhang Jian , Max Chou , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 28/32] target/riscv: Add Zc extension implied rule Date: Thu, 27 Jun 2024 20:00:49 +1000 Message-ID: <20240627100053.150937-29-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::230; envelope-from=alistair23@gmail.com; helo=mail-oi1-x230.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482735822100009 Content-Type: text/plain; charset="utf-8" From: Frank Chang Zc extension has special implied rules that need to be handled separately. Signed-off-by: Frank Chang Reviewed-by: Jerry Zhang Jian Tested-by: Max Chou Reviewed-by: Daniel Henrique Barboza Message-ID: <20240625114629.27793-6-frank.chang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/tcg/tcg-cpu.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 1a3aef5bff..ccca9037ed 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -925,11 +925,45 @@ static void cpu_enable_implied_rule(RISCVCPU *cpu, } } =20 +/* Zc extension has special implied rules that need to be handled separate= ly. */ +static void cpu_enable_zc_implied_rules(RISCVCPU *cpu) +{ + RISCVCPUClass *mcc =3D RISCV_CPU_GET_CLASS(cpu); + CPURISCVState *env =3D &cpu->env; + + if (cpu->cfg.ext_zce) { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcb), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmp), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmt), true); + + if (riscv_has_ext(env, RVF) && mcc->misa_mxl_max =3D=3D MXL_RV32) { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcf), true); + } + } + + /* Zca, Zcd and Zcf has a PRIV 1.12.0 restriction */ + if (riscv_has_ext(env, RVC) && env->priv_ver >=3D PRIV_VERSION_1_12_0)= { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true); + + if (riscv_has_ext(env, RVF) && mcc->misa_mxl_max =3D=3D MXL_RV32) { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcf), true); + } + + if (riscv_has_ext(env, RVD)) { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcd), true); + } + } +} + static void riscv_cpu_enable_implied_rules(RISCVCPU *cpu) { RISCVCPUImpliedExtsRule *rule; int i; =20 + /* Enable the implied extensions for Zc. */ + cpu_enable_zc_implied_rules(cpu); + /* Enable the implied MISAs. */ for (i =3D 0; (rule =3D riscv_misa_ext_implied_rules[i]); i++) { if (riscv_has_ext(&cpu->env, rule->ext)) { --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482658; cv=none; d=zohomail.com; s=zohoarc; b=CErdzzGS/qORTeihO6y2f0mHEx8YNNwFg/60J8gCn0JgX89upjudgYzAf+QWOL27bNjN6CWMyYydc58t4X7RhdCKsJC0uX8RLmDdvsriLgtL6+QSaIKc174e0f/jFGMtvsZ3DDh76xWs3r7/1PQByQrfERYbZX2mCHmWDGCLvBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482658; 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=0CiGEo1Y49vMlYu6YFDvaSALmsVarL7E0mLlpzBDHLw=; b=d1Q6NqKpyjDo8HckYQNOZ2hUn2mYcBmL06LyAszJjmds584TSTzunIRGclnqvi6DehVZGygcj6SnRCvEssz7RxvUDje5FTQbiZCn89XiYs1ghskjhWWlAiVcGJmjd0LkobMHzAgC9zg+BAqPv9NuiIvwYRFpE+uytsyEYVcg7HE= 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 1719482658011328.018399636303; Thu, 27 Jun 2024 03:04:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxp-00088n-Sw; Thu, 27 Jun 2024 06:02:49 -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 1sMlxk-0007O4-9Z for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:44 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxh-0002db-RF for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:43 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-70679845d69so3371292b3a.1 for ; Thu, 27 Jun 2024 03:02:41 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482560; x=1720087360; 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=0CiGEo1Y49vMlYu6YFDvaSALmsVarL7E0mLlpzBDHLw=; b=FbJaKiMjqLyaey+EdcDA4+XNQdcjaYrOdJ2OJQa4HNy8UAIiqSxcOD5khsA6z3kbGR gDeLUb/wCNFZWBDEYx6IXaVIF/ppqhDU4Ww1ay6vSl4IN7kAz3usynEnXFAd7vh52nQz t5ebzI2SqQX6gt/ykQAvaMroUPKRpChRNFMJQkFtZDzsI4mADR/9xvY51Cjz9p8Kaihh AD+UeQrzyRdvj5E3wSYjbtK808z8uQq19feap0/jPokAOJkjw5QGkkkQn+O8TEfuP1YR eilXGrFQ0fBOONY39RzJ+vAOIkV/maAgjsy8w4ytC895zp9IXVb1Oho88Jh7zh6rGAgj s8Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482560; x=1720087360; 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=0CiGEo1Y49vMlYu6YFDvaSALmsVarL7E0mLlpzBDHLw=; b=diumcG1wc+1PwudRjYCibok1cXz+OetoyJLQjw2anR7X3ATiqIL7bMiV5hIBQvYyYU GsAljMuL5LAyDsjjKsiySVQKaSZbcp5g5wMsRDRnXY5I7+QiCPn9yRH6hSTTo4hUbK+E HDUq6bO6QZvza7Dps8RPDLz+fIjeKOJATiUjSNOFzeLzsnsqWodIKFXpWWW4aL6vCiHj LIoWv3pI2QZnbQAWahzBuNCtOdrqOd5hInr+NhnFxBQHji5sdtaKJtGNtFMBMqUGPAYu yYz09CxyEnjmyb7MA9s5EuChbkuoErXF5Qn8w9z7GBywTsqZ6WkenZLY3rXW/EMYd5JU PFhg== X-Gm-Message-State: AOJu0YzDcolouThSUvPUQ0F38MyoYhHB+K4Mgkcdm+Q4bOucIfhHqbFg iun3CsGGkkAA77vG5LgkoW9qT4kD6M5DA0m+uH9j39ppEFiBUiXphSTwfb7m X-Google-Smtp-Source: AGHT+IFxyeVOxvHAWK/I6aiu5y9meVreMlZTjABEQSxjEWxsqA9EhRjkOMNoYZTzdDrTCqG6xW8z8w== X-Received: by 2002:a05:6a00:cd0:b0:706:348a:528a with SMTP id d2e1a72fcca58-7067459a758mr16330700b3a.10.1719482560004; Thu, 27 Jun 2024 03:02:40 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Frank Chang , Jerry Zhang Jian , Max Chou , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 29/32] target/riscv: Remove extension auto-update check statements Date: Thu, 27 Jun 2024 20:00:50 +1000 Message-ID: <20240627100053.150937-30-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::42c; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482659341100001 Content-Type: text/plain; charset="utf-8" From: Frank Chang Remove the old-fashioned extension auto-update check statements as they are replaced by the extension implied rules. Signed-off-by: Frank Chang Reviewed-by: Jerry Zhang Jian Tested-by: Max Chou Reviewed-by: Daniel Henrique Barboza Message-ID: <20240625114629.27793-7-frank.chang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/tcg/tcg-cpu.c | 119 ------------------------------------- 1 file changed, 119 deletions(-) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index ccca9037ed..ae25686824 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -471,10 +471,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) return; } =20 - if (cpu->cfg.ext_zfh) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zfhmin), true); - } - if (cpu->cfg.ext_zfhmin && !riscv_has_ext(env, RVF)) { error_setg(errp, "Zfh/Zfhmin extensions require F extension"); return; @@ -496,9 +492,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, E= rror **errp) error_propagate(errp, local_err); return; } - - /* The V vector extension depends on the Zve64d extension */ - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64d), true); } =20 /* The Zve64d extension depends on the Zve64f extension */ @@ -507,18 +500,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) error_setg(errp, "Zve64d/V extensions require D extension"); return; } - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64f), true); - } - - /* The Zve64f extension depends on the Zve64x and Zve32f extensions */ - if (cpu->cfg.ext_zve64f) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64x), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32f), true); - } - - /* The Zve64x extension depends on the Zve32x extension */ - if (cpu->cfg.ext_zve64x) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32x), true); } =20 /* The Zve32f extension depends on the Zve32x extension */ @@ -527,11 +508,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) error_setg(errp, "Zve32f/Zve64f extensions require F extension= "); return; } - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32x), true); - } - - if (cpu->cfg.ext_zvfh) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvfhmin), true); } =20 if (cpu->cfg.ext_zvfhmin && !cpu->cfg.ext_zve32f) { @@ -554,11 +530,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) return; } =20 - /* Set the ISA extensions, checks should have happened above */ - if (cpu->cfg.ext_zhinx) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true); - } - if ((cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) && !cpu->cfg.ext_zfi= nx) { error_setg(errp, "Zdinx/Zhinx/Zhinxmin extensions require Zfinx"); return; @@ -576,27 +547,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) } } =20 - if (cpu->cfg.ext_zce) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcb), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmp), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmt), true); - if (riscv_has_ext(env, RVF) && mcc->misa_mxl_max =3D=3D MXL_RV32) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcf), true); - } - } - - /* zca, zcd and zcf has a PRIV 1.12.0 restriction */ - if (riscv_has_ext(env, RVC) && env->priv_ver >=3D PRIV_VERSION_1_12_0)= { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true); - if (riscv_has_ext(env, RVF) && mcc->misa_mxl_max =3D=3D MXL_RV32) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcf), true); - } - if (riscv_has_ext(env, RVD)) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcd), true); - } - } - if (mcc->misa_mxl_max !=3D MXL_RV32 && cpu->cfg.ext_zcf) { error_setg(errp, "Zcf extension is only relevant to RV32"); return; @@ -630,52 +580,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) return; } =20 - /* - * Shorthand vector crypto extensions - */ - if (cpu->cfg.ext_zvknc) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkn), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvbc), true); - } - - if (cpu->cfg.ext_zvkng) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkn), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkg), true); - } - - if (cpu->cfg.ext_zvkn) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkned), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvknhb), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkb), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkt), true); - } - - if (cpu->cfg.ext_zvksc) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvks), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvbc), true); - } - - if (cpu->cfg.ext_zvksg) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvks), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkg), true); - } - - if (cpu->cfg.ext_zvks) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvksed), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvksh), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkb), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkt), true); - } - - if (cpu->cfg.ext_zvkt) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvbb), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvbc), true); - } - - if (cpu->cfg.ext_zvbb) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvkb), true); - } - if ((cpu->cfg.ext_zvbb || cpu->cfg.ext_zvkb || cpu->cfg.ext_zvkg || cpu->cfg.ext_zvkned || cpu->cfg.ext_zvknha || cpu->cfg.ext_zvksed= || cpu->cfg.ext_zvksh) && !cpu->cfg.ext_zve32x) { @@ -691,29 +595,6 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) return; } =20 - if (cpu->cfg.ext_zk) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkn), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkr), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkt), true); - } - - if (cpu->cfg.ext_zkn) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkb), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkc), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkx), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkne), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zknd), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zknh), true); - } - - if (cpu->cfg.ext_zks) { - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkb), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkc), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkx), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zksed), true); - cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zksh), true); - } - if (cpu->cfg.ext_zicntr && !cpu->cfg.ext_zicsr) { if (cpu_cfg_ext_is_user_set(CPU_CFG_OFFSET(ext_zicntr))) { error_setg(errp, "zicntr requires zicsr"); --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482759; cv=none; d=zohomail.com; s=zohoarc; b=YwvOLSSQXEw1qZ4U5lE/EpAQrS37EntC3Bv7IJvni9CoVPfG+FScrmtE/OZTdVob9ur3dW1nMyBAwEM3tXEvBN+7dn/A5t1r7vRbSbX4JaxfNsaYaQSwq1VBH28FjYDg35Nwq+PkcxyToelLGRgiAPGysyASe8ZMB0Aljz4QZYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482759; 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=cDQcF84dre27NKrwxyR57edDUqmhHmvi6h4uP6eUGW4=; b=aD+2ySVi3wOepWACYqQ+UEFW+gegs3zrk3ZKlusA4Hf9HUgOW9AiAD+JEwsjwoZvJ4PyJZqu9GNNq/1qE3d/guUN8U95CxAOGtlOE5u6T8pXPf/FSc4vKej0dH21z5YaOZ+ZRcIx1UGboCMfdnkjBmoLL4CE7zhLo2IXaCCAMXw= 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 1719482759971281.64476283782824; Thu, 27 Jun 2024 03:05:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxp-00089Z-Vl; Thu, 27 Jun 2024 06:02:50 -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 1sMlxm-0007gd-PK for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:46 -0400 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxk-0002hS-EP for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:46 -0400 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-25cb3f1765bso3965839fac.1 for ; Thu, 27 Jun 2024 03:02:43 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482563; x=1720087363; 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=cDQcF84dre27NKrwxyR57edDUqmhHmvi6h4uP6eUGW4=; b=gTgh/koDtKWDZLXV3XOeA+ArnkcO7w2jGSAM8Kf+JBzQrIm1FKTJJvA0pn/OjyNuSq GlxgWdRXA8arVw4u0XTZ/O1PJCcBO8naPkieZRvzTcYzX463nnA+IjhZBCEWXVqVZJ7a sde9rRz9qcM7c3nv9p1NZOvwtsWsoPuVJnCNubIYrVtXoYjWrnfiOF0YCz/b0dn8whgE 0gCsnlTYmRysPdl4MLi/cgc91dmEH7VKWLavgThS7tosxpJYYM6kX1/xYp8xgT1s8doh lV1W+aQzn4k29LtMnY9essgpo40jlz4zquXrs35iFkCPga/J1vkdcuFeyglLoTd94uID U03w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482563; x=1720087363; 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=cDQcF84dre27NKrwxyR57edDUqmhHmvi6h4uP6eUGW4=; b=f4EYStEI/SPUy/Q1lSvovZRotNPIQwrXlr1fhdjyLq1huts6UBC/nuJzo9d6t6F2Qh lHVNaQquUVQioHt+lzwSZ/QVNnHomLhUzfQNxYYiUYMyzXpgjf60y24LWXtiZ5uzlizQ Wlw8N1LGy5rJ7wUezo/gre3tqZWqY9qIgeHv/qZAQBFt6ie5p/zXbcn8HGTQcTPitKLt mRKqfIMrEwQANA4gYh1NqEe0KlCmTCU3C2yrY3DGnkL63KWvZxq4oClNZiVM4s6QV49W YzV23lIWdl6G1RIHXhPIqwFQHL0z/MZ1GuOu0wIZUmGwmeHvfYJvH0JFiv5tU6U5ausr TtZA== X-Gm-Message-State: AOJu0YyXV6tlk/yOO/nDPOfIEQbZ0Wqzi+5Q5LYwx6BlutJK9Fsu0DK3 pO4E6TUNQjVJ38gRsDTHRbiMjsnf+pHQcAKyVijvfqYF1SdwOiKQpRksnb9g X-Google-Smtp-Source: AGHT+IHaR4uoCayL/kQbVJIxOjQmdU+U6FiaTlptZ719Vt61JO3ifSee0Yz734yodVkLat7Z6nof9g== X-Received: by 2002:a05:6870:828b:b0:25c:c42b:5349 with SMTP id 586e51a60fabf-25d06f021c4mr12401782fac.59.1719482562789; Thu, 27 Jun 2024 03:02:42 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Alvin Chang , Alistair Francis Subject: [PULL 30/32] target/riscv: Add functions for common matching conditions of trigger Date: Thu, 27 Jun 2024 20:00:51 +1000 Message-ID: <20240627100053.150937-31-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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=2001:4860:4864:20::30; envelope-from=alistair23@gmail.com; helo=mail-oa1-x30.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482761822100007 Content-Type: text/plain; charset="utf-8" From: Alvin Chang According to RISC-V Debug specification version 0.13 [1] (also applied to version 1.0 [2] but it has not been ratified yet), there are several common matching conditions before firing a trigger, including the enabled privilege levels of the trigger. This commit adds trigger_common_match() to prepare the common matching conditions for the type 2/3/6 triggers. For now, we just implement trigger_priv_match() to check if the enabled privilege levels of the trigger match CPU's current privilege level. Remove the related code in riscv_cpu_debug_check_breakpoint() and invoke trigger_common_match() to check the privilege levels of the type 2 and type 6 triggers for the breakpoints. This commit also changes the behavior of looping the triggers. In previous implementation, if we have a type 2 trigger and env->virt_enabled is true, we directly return false to stop the loop. Now we keep looping all the triggers until we find a matched trigger. Only the execution bit and the executed PC should be futher checked in riscv_cpu_debug_check_breakpoint(). [1]: https://github.com/riscv/riscv-debug-spec/releases/tag/task_group_vote [2]: https://github.com/riscv/riscv-debug-spec/releases/tag/1.0.0-rc1-ascii= doc Signed-off-by: Alvin Chang Reviewed-by: Alistair Francis Message-ID: <20240626132247.2761286-2-alvinga@andestech.com> Signed-off-by: Alistair Francis --- target/riscv/debug.c | 101 +++++++++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 23 deletions(-) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index b110370ea6..11125f333b 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -241,6 +241,76 @@ static void do_trigger_action(CPURISCVState *env, targ= et_ulong trigger_index) } } =20 +/* + * Check the privilege level of specific trigger matches CPU's current pri= vilege + * level. + */ +static bool trigger_priv_match(CPURISCVState *env, trigger_type_t type, + int trigger_index) +{ + target_ulong ctrl =3D env->tdata1[trigger_index]; + + switch (type) { + case TRIGGER_TYPE_AD_MATCH: + /* type 2 trigger cannot be fired in VU/VS mode */ + if (env->virt_enabled) { + return false; + } + /* check U/S/M bit against current privilege level */ + if ((ctrl >> 3) & BIT(env->priv)) { + return true; + } + break; + case TRIGGER_TYPE_AD_MATCH6: + if (env->virt_enabled) { + /* check VU/VS bit against current privilege level */ + if ((ctrl >> 23) & BIT(env->priv)) { + return true; + } + } else { + /* check U/S/M bit against current privilege level */ + if ((ctrl >> 3) & BIT(env->priv)) { + return true; + } + } + break; + case TRIGGER_TYPE_INST_CNT: + if (env->virt_enabled) { + /* check VU/VS bit against current privilege level */ + if ((ctrl >> 25) & BIT(env->priv)) { + return true; + } + } else { + /* check U/S/M bit against current privilege level */ + if ((ctrl >> 6) & BIT(env->priv)) { + return true; + } + } + break; + case TRIGGER_TYPE_INT: + case TRIGGER_TYPE_EXCP: + case TRIGGER_TYPE_EXT_SRC: + qemu_log_mask(LOG_UNIMP, "trigger type: %d is not supported\n", ty= pe); + break; + case TRIGGER_TYPE_NO_EXIST: + case TRIGGER_TYPE_UNAVAIL: + qemu_log_mask(LOG_GUEST_ERROR, "trigger type: %d does not exist\n", + type); + break; + default: + g_assert_not_reached(); + } + + return false; +} + +/* Common matching conditions for all types of the triggers. */ +static bool trigger_common_match(CPURISCVState *env, trigger_type_t type, + int trigger_index) +{ + return trigger_priv_match(env, type, trigger_index); +} + /* type 2 trigger */ =20 static uint32_t type2_breakpoint_size(CPURISCVState *env, target_ulong ctr= l) @@ -785,22 +855,18 @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs) for (i =3D 0; i < RV_MAX_TRIGGERS; i++) { trigger_type =3D get_trigger_type(env, i); =20 + if (!trigger_common_match(env, trigger_type, i)) { + continue; + } + switch (trigger_type) { case TRIGGER_TYPE_AD_MATCH: - /* type 2 trigger cannot be fired in VU/VS mode */ - if (env->virt_enabled) { - return false; - } - ctrl =3D env->tdata1[i]; pc =3D env->tdata2[i]; =20 if ((ctrl & TYPE2_EXEC) && (bp->pc =3D=3D pc)) { - /* check U/S/M bit against current privilege level */ - if ((ctrl >> 3) & BIT(env->priv)) { - env->badaddr =3D pc; - return true; - } + env->badaddr =3D pc; + return true; } break; case TRIGGER_TYPE_AD_MATCH6: @@ -808,19 +874,8 @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs) pc =3D env->tdata2[i]; =20 if ((ctrl & TYPE6_EXEC) && (bp->pc =3D=3D pc)) { - if (env->virt_enabled) { - /* check VU/VS bit against current privilege level= */ - if ((ctrl >> 23) & BIT(env->priv)) { - env->badaddr =3D pc; - return true; - } - } else { - /* check U/S/M bit against current privilege level= */ - if ((ctrl >> 3) & BIT(env->priv)) { - env->badaddr =3D pc; - return true; - } - } + env->badaddr =3D pc; + return true; } break; default: --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482769; cv=none; d=zohomail.com; s=zohoarc; b=gp2aT/72z/bGTwwKoLq4y86J/XMia0cd66228NhvpptE8INZQdbcp6qmmele7wPUpYW+S3Cd/0rSSa0fA87hi7LsKTXaglDXOf6kjgMM0+dLIS1ldHcbvqUv0dV87COfspwrAkf4X0FA+I3hGiPH4its+u7yUJRy88vxjAMwX/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482769; 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=R2ySpE5U7zE2XXo/BjdiRlPjhvKqenUQik4nMBEH7xQ=; b=IxLIHa1CuZ9NCKko2rF02yg9xRSi8uBG/wA1HUQCwZOPpkI1mB5HTCnt2y6GTotVi3fh/oIo2i8hhDC9h0ZiPviiON60KG1Knsk+vtvss8lJ7xcOoXu68mYsBORJYVyad6eMrrZ0id17c+nX9ugaRU4fx5WOS0n8XquU5Nw3joM= 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 1719482769940238.48943361307443; Thu, 27 Jun 2024 03:06:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxr-0008OT-E0; Thu, 27 Jun 2024 06:02:51 -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 1sMlxp-00085K-D5 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:49 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxn-0002jk-AK for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:48 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-7066a4a611dso3747936b3a.3 for ; Thu, 27 Jun 2024 03:02:46 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482566; x=1720087366; 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=R2ySpE5U7zE2XXo/BjdiRlPjhvKqenUQik4nMBEH7xQ=; b=fsFSMm6qA7MUGs3xDfmNOfyFSemvUHopQzGEwKrxx1YgiWaldbw0+6bH5QE2zQU9tA oDGw9BlgUk30n9p0hHa6mCknCLt6/C+efVtuWwBq57poOS9R2KL42ZDMZDANYsnTonsf YDJrMrna3JTKf+SP/VpEQ70EfcMkrYXs3Ra4k+jPjrgFQe4UUX8UAcrNLOC1cI1E73d0 P9w7284+gMsA4+JYIiK/7+wLIN81buptlRYUG8wq9U2mAu7jRL4bccrEr1qRjZDcQEv+ A3SEuB/tc8aRkUdKXRUTaUqUxg83IbMsrUVRCxmMKTvm6P2MNGU0usVxEMBCMpqJVvkV S1mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482566; x=1720087366; 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=R2ySpE5U7zE2XXo/BjdiRlPjhvKqenUQik4nMBEH7xQ=; b=sFyxnp6DYGvfib1kZhx35XyatX8g+4OoiudI9y1xFCyplMHx/L+49fFXkcYAUTfoBU C/JkrNKV/6p0f0mv3zYI2PL8YqFntb74DjMwAY7hMW65uwyeZi95Sn6pfPvd/uon+buQ ADoZuahBEPxk3ps43tZqHGLZLHADKkkFsD6islP0Uxk34YFh4x9lqtqUgrWYPHudmo6D isdPnPMDcLBNVvaa/euBCIzyWfR6tac9NNskW6OxH5Hn9+dKc15nTHLmSbTZM79DdIE+ edKs8VYYSItl8vPjyVNGqNaHVpDsB0YlBA5rgs2LD+daFn+X3Z/wJ1U7yBGUpcwd4mmZ qqhQ== X-Gm-Message-State: AOJu0Yy+aF44K8uhlFMRsea/PTN1qYTO9EItq3rbvgKT2Xxzq8SJAKRi whfoQLql7M/p0G1nT9erZtnaLICnVT0cUQ129aD7f7ZHOCYYMitwe6ChfwoA X-Google-Smtp-Source: AGHT+IF3B6v82GALcn8dTX5L8YxkKs51s5fCTOPBZvyWyQjDweO1JF0/t5JzVKSFu+AjrNvUBy6I4g== X-Received: by 2002:aa7:8a53:0:b0:706:29e6:2edf with SMTP id d2e1a72fcca58-70674548ef7mr11921175b3a.4.1719482565544; Thu, 27 Jun 2024 03:02:45 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Alvin Chang , Alistair Francis Subject: [PULL 31/32] target/riscv: Apply modularized matching conditions for watchpoint Date: Thu, 27 Jun 2024 20:00:52 +1000 Message-ID: <20240627100053.150937-32-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::435; envelope-from=alistair23@gmail.com; helo=mail-pf1-x435.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482771922100003 Content-Type: text/plain; charset="utf-8" From: Alvin Chang We have implemented trigger_common_match(), which checks if the enabled privilege levels of the trigger match CPU's current privilege level. Remove the related code in riscv_cpu_debug_check_watchpoint() and invoke trigger_common_match() to check the privilege levels of the type 2 and type 6 triggers for the watchpoints. This commit also changes the behavior of looping the triggers. In previous implementation, if we have a type 2 trigger and env->virt_enabled is true, we directly return false to stop the loop. Now we keep looping all the triggers until we find a matched trigger. Only load/store bits and loaded/stored address should be further checked in riscv_cpu_debug_check_watchpoint(). Signed-off-by: Alvin Chang Acked-by: Alistair Francis Message-ID: <20240626132247.2761286-3-alvinga@andestech.com> Signed-off-by: Alistair Francis --- target/riscv/debug.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 11125f333b..c290d6002e 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -901,13 +901,12 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, C= PUWatchpoint *wp) for (i =3D 0; i < RV_MAX_TRIGGERS; i++) { trigger_type =3D get_trigger_type(env, i); =20 + if (!trigger_common_match(env, trigger_type, i)) { + continue; + } + switch (trigger_type) { case TRIGGER_TYPE_AD_MATCH: - /* type 2 trigger cannot be fired in VU/VS mode */ - if (env->virt_enabled) { - return false; - } - ctrl =3D env->tdata1[i]; addr =3D env->tdata2[i]; flags =3D 0; @@ -920,10 +919,7 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CP= UWatchpoint *wp) } =20 if ((wp->flags & flags) && (wp->vaddr =3D=3D addr)) { - /* check U/S/M bit against current privilege level */ - if ((ctrl >> 3) & BIT(env->priv)) { - return true; - } + return true; } break; case TRIGGER_TYPE_AD_MATCH6: @@ -939,17 +935,7 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CP= UWatchpoint *wp) } =20 if ((wp->flags & flags) && (wp->vaddr =3D=3D addr)) { - if (env->virt_enabled) { - /* check VU/VS bit against current privilege level */ - if ((ctrl >> 23) & BIT(env->priv)) { - return true; - } - } else { - /* check U/S/M bit against current privilege level */ - if ((ctrl >> 3) & BIT(env->priv)) { - return true; - } - } + return true; } break; default: --=20 2.45.2 From nobody Sun Nov 24 23:33:34 2024 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=1719482740; cv=none; d=zohomail.com; s=zohoarc; b=RbYfLuuUR1lJFX8IX5nC0UWX+emDWEIQvzICvZ6WECAn8KPupH5UfUdH1xnk5cXw2KSnW4bten7Q7cDyoKQhZ4wvlEc12SCwL0joEPsn5+F774ewPmotI2IMPIp2JlGceorZfgD2bCAdShRfp7cE0ajNTGMwrlgu033656vFZ60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719482740; 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=h+j6fKPVNUKUnpKxQMAdtrznAy8Ydu67u7x9DuieKE0=; b=gmCrVRhIsK1sJA/VResjZ2CKLj49SFyiuYrCOvTkFvLYeaTEunHcK9DWfejqry7b4Bg8zwsPO6RkvxEjaAjKyfH8bBjcyn9gQ28mQY+riTP47te9oA1GF6+y/cz0q4SjykSpHoEc+3N2+NG2K6GiQMOOeZz/0a0E+/ENwbETRDY= 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 1719482740457642.6502138147845; Thu, 27 Jun 2024 03:05:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMlxu-0000LT-F2; Thu, 27 Jun 2024 06:02:54 -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 1sMlxr-0008Rq-Oq for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:51 -0400 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMlxp-0002qx-Uj for qemu-devel@nongnu.org; Thu, 27 Jun 2024 06:02:51 -0400 Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7f61549406eso12605339f.1 for ; Thu, 27 Jun 2024 03:02:49 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-82ce-f179-8a79-69f4.ip6.aussiebb.net. [2403:580b:97e8:0:82ce:f179:8a79:69f4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a07326sm932431b3a.111.2024.06.27.03.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 03:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719482568; x=1720087368; 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=h+j6fKPVNUKUnpKxQMAdtrznAy8Ydu67u7x9DuieKE0=; b=I8j3lzUZAi/FSmYd2acqpG6FgRmbVaqptERU3A0gGZRe1spJksiCPOYU5fWIMJZpv6 OxxCjGy5SXl83GdKCxDr5wuhNfDe6hARPfROeW14jhv51sl+b4NeYWIpB3ZbPXry/vvw CrxrAn7Bx7DUFNWHtCuU2mCXsVTDAqQZxN4zwwUWIrLfSUSNY4PtFy0B9yKzOYKZvSb7 h0PGiB3Y50Wqnbf9wcMsGAmij9cs2gn49H70nMSmAUMGd0q+atCHVlPFXl2WE8iM7K/W PUV/DA8tsHgqPB8z+y4pviLIql1GMKIyPTbILL2EwUK0XOlnKO1oxEvID16emu9Tr13v F73Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719482568; x=1720087368; 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=h+j6fKPVNUKUnpKxQMAdtrznAy8Ydu67u7x9DuieKE0=; b=WSh0VFnEqoec/5O+ZdjCFDlXJwTN3fGnPAiW1r/beS99HGDqNk0zZRADwk7OvlBj6n ssoGL8uCsdlarOxG/gASKl5hQPUVwJO2/qMLEnpc4UbabpcWaAFJ0H0QBoewE3Zb4ndD cBQRq9Kdtz4RTTVPVrroUQRDVeQuvSb3NZGl5QC8pPxEzC5I76ttL6v9xu4tFJR7ZtyE lPu8yt2gLV1EIpoATicX2ogHT1mkLCq5KwHferI0R8CZsxFmDf1KTJ74sHydRPFYiJlb I3LlIX2uCJh5ZLBtdZoM5+ZPZskyAnIhM4Knx1/DeJMe8a+YHqTmZtw3RIYreexjVU6l R5Sw== X-Gm-Message-State: AOJu0YxHKqBuXXpzEuoaWZ4c0RUFH7s0pTfyQILAvlgDl8bP4uftTqjv Wc+5IO49hQ4KvIAPn2n3atWdlDmFJTIIErU8IoeJRPYT5fcNinZDmUX13X/r X-Google-Smtp-Source: AGHT+IHNOnh4snA1JbyAl60XYCAUC6EPph/N571XudXc5WX1XegVfyIoxxTlpRi6NKvpqP+zREoRbQ== X-Received: by 2002:a05:6602:6d15:b0:7eb:71b9:fc8 with SMTP id ca18e2360f4ac-7f3a755b3c3mr1514878739f.16.1719482568291; Thu, 27 Jun 2024 03:02:48 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Alvin Chang , Alistair Francis Subject: [PULL 32/32] target/riscv: Apply modularized matching conditions for icount trigger Date: Thu, 27 Jun 2024 20:00:53 +1000 Message-ID: <20240627100053.150937-33-alistair.francis@wdc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627100053.150937-1-alistair.francis@wdc.com> References: <20240627100053.150937-1-alistair.francis@wdc.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::d31; envelope-from=alistair23@gmail.com; helo=mail-io1-xd31.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1719482741876100001 Content-Type: text/plain; charset="utf-8" From: Alvin Chang We have implemented trigger_common_match(), which checks if the enabled privilege levels of the trigger match CPU's current privilege level. We can invoke trigger_common_match() to check the privilege levels of the type 3 triggers. Signed-off-by: Alvin Chang Acked-by: Alistair Francis Message-ID: <20240626132247.2761286-4-alvinga@andestech.com> Signed-off-by: Alistair Francis --- target/riscv/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index c290d6002e..0b5099ff9a 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -624,7 +624,7 @@ void helper_itrigger_match(CPURISCVState *env) if (get_trigger_type(env, i) !=3D TRIGGER_TYPE_INST_CNT) { continue; } - if (check_itrigger_priv(env, i)) { + if (!trigger_common_match(env, TRIGGER_TYPE_INST_CNT, i)) { continue; } count =3D itrigger_get_count(env, i); --=20 2.45.2