From nobody Wed Nov 27 20:03:02 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 ARC-Seal: i=1; a=rsa-sha256; t=1728587104; cv=none; d=zohomail.com; s=zohoarc; b=QDf79Y4nvVe6ouYDj1SwcwD3lrhqd4ERzAMTQiG1ELEglxvtpdNv37OkoxNiWoS7arvBd7577M4JF4PHoRDDtz0ezvfZXhwRyzexj0BJhvTZNPjQ5DVeSl8aXBea3LI6uKF60Bt5XhMwKtQQdC+UwL+uYWCIVC/iME71IMt49i0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728587104; 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=GPrzIa4nG4f+V6JITUP+rCk9SaYCtpeZ5a6iOcrm8J4=; b=BhITmgLxubalLx+Y+peUebEOjcBkKysSk71x4785rKyTVlaUeOxO5/qFWxmg0lKoHpE1WMV3WDdNWQzrRknd+ncauHXDyaLG6NgCeK1j+l4ZNNK+27FrktTo7mDCgKCbxj3ni7qXClfAx/MhMX39BRyJFhHwT99L52je42jcxaU= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728587104381114.10977715507295; Thu, 10 Oct 2024 12:05:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syyS6-00063W-RG; Thu, 10 Oct 2024 15:03:58 -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 1syyS4-00062o-V2 for qemu-devel@nongnu.org; Thu, 10 Oct 2024 15:03:56 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syyS2-0004j2-7K for qemu-devel@nongnu.org; Thu, 10 Oct 2024 15:03:56 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7db1f13b14aso1071396a12.1 for ; Thu, 10 Oct 2024 12:03:53 -0700 (PDT) Received: from grind.. (201-68-240-198.dsl.telesp.net.br. [201.68.240.198]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e2a9f5263sm1354532b3a.62.2024.10.10.12.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 12:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1728587032; x=1729191832; 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=GPrzIa4nG4f+V6JITUP+rCk9SaYCtpeZ5a6iOcrm8J4=; b=D7/K7meimqsm/J68pPk8g5p8mibRQE6vbwofzEZuNTpaJBemgy7PXHG0zqVnAJZGu3 +hCfixR/7yKfH0zCOYpNcmX7fFYIxIg8p/3jKP3akjFsNClj2mEOj8SGzC6iWtPpkkAc cjqPVXjK4FpOw/CjrttrB2EhLp6rv3CjtzZwac4CXE4xciX8R8Xq88tonQ+VzqxGy1YE 94nj5OWAA7MyhZaXpv0uuwJu2upFqsXgH8vlAaY6S16btCrpiHc5AH57ow2qT9u6P5i4 lLUFPkIBdqo5BhxnodABhZZzLRNm76+bhD2VXs6Xw8h2jyP+MvmO7s1NT83YY2N2dEg/ RLVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728587032; x=1729191832; 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=GPrzIa4nG4f+V6JITUP+rCk9SaYCtpeZ5a6iOcrm8J4=; b=dJjmra/gV2IT29rX3oqzC+Vv3FCQu7l7tdOW3XfI5iiYtv63GLer1Vvfn05dsE5DmP gZm5tJT1lA/aacX8lzF6WZr/dQNnv+Vi1flaZDSZRwOSOori1cnXV+MLYC68eZfikCkS sAbUo/kbXDyUuHKrR2YZAmZMm+UWC9wZAm2EwRSbyVrPNJT9lKzJNNQBqzuYJ+i5tpIk 0i+Xwrx5K7L4nCWw/w53AbEPhdzznGqyPY+F8qz7Id5URvmswSTJ35KYeSiZHuejE6Ls ZeEQF8dJoYMCB771sbHKtEF74ntyYVb/JMZ2rzVIGJ/zqxThQobp0LBzrOzSvR2SjJHx xILQ== X-Gm-Message-State: AOJu0Yz8rvVsR8/SJCF0cjI8uLc84XlRrR4DWMTkfn1nYYJbo2ruaSyQ VRhXqWIQ7ikaJlnt53nZ75J3oSXJoJRl3mp5L/W+pXwH+YRi1IqgPoQeffJ9iZaS2PxELAZRtnx F X-Google-Smtp-Source: AGHT+IFzONBhwFvPP2XjphuuwdTbYOp0vQX1CQzxBPTu/J+Pt4eK8dna3JP6075OmmzDVVTIOc9PhA== X-Received: by 2002:a05:6a20:e18a:b0:1d3:b30:44a2 with SMTP id adf61e73a8af0-1d8bcefa643mr28802637.7.1728587032575; Thu, 10 Oct 2024 12:03:52 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH 3/8] hw/riscv/virt.c: rename helper to virt_use_kvm_aia_aplic_imsic() Date: Thu, 10 Oct 2024 16:03:32 -0300 Message-ID: <20241010190337.376987-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010190337.376987-1-dbarboza@ventanamicro.com> References: <20241010190337.376987-1-dbarboza@ventanamicro.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::52b; envelope-from=dbarboza@ventanamicro.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @ventanamicro.com) X-ZM-MESSAGEID: 1728587105808116600 Content-Type: text/plain; charset="utf-8" Similar to the riscv_is_kvm_aia_aplic_imsic() helper from riscv_aplic.c, the existing virt_use_kvm_aia() is testing for KVM aia=3Daplic-imsic with in-kernel irqchip enabled. It is not checking for a generic AIA support. Rename the helper to virt_use_kvm_aia_aplic_imsic() to reflect what the helper is doing, and use the existing riscv_is_kvm_aia_aplic_imsic() to obscure details such as the presence of the in-kernel irqchip. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- hw/riscv/virt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index b5bdbb34e0..f1bdc1c535 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -57,9 +57,11 @@ #include "hw/virtio/virtio-iommu.h" =20 /* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU= . */ -static bool virt_use_kvm_aia(RISCVVirtState *s) +static bool virt_use_kvm_aia_aplic_imsic(RISCVVirtAIAType aia_type) { - return kvm_irqchip_in_kernel() && s->aia_type =3D=3D VIRT_AIA_TYPE_APL= IC_IMSIC; + bool msimode =3D aia_type =3D=3D VIRT_AIA_TYPE_APLIC_IMSIC; + + return riscv_is_kvm_aia_aplic_imsic(msimode); } =20 static bool virt_aclint_allowed(void) @@ -774,8 +776,8 @@ static void create_fdt_sockets(RISCVVirtState *s, const= MemMapEntry *memmap, *msi_pcie_phandle =3D msi_s_phandle; } =20 - /* KVM AIA only has one APLIC instance */ - if (kvm_enabled() && virt_use_kvm_aia(s)) { + /* KVM AIA aplic-imsic only has one APLIC instance */ + if (kvm_enabled() && virt_use_kvm_aia_aplic_imsic(s->aia_type)) { create_fdt_socket_aplic(s, memmap, 0, msi_m_phandle, msi_s_phandle, phandle, &intc_phandles[0], xplic_phandles, @@ -1540,7 +1542,7 @@ static void virt_machine_init(MachineState *machine) } } =20 - if (kvm_enabled() && virt_use_kvm_aia(s)) { + if (kvm_enabled() && virt_use_kvm_aia_aplic_imsic(s->aia_type)) { kvm_riscv_aia_create(machine, IMSIC_MMIO_GROUP_MIN_SHIFT, VIRT_IRQCHIP_NUM_SOURCES, VIRT_IRQCHIP_NUM_MS= IS, memmap[VIRT_APLIC_S].base, --=20 2.45.2