From patchwork Sun Oct 20 19:47:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1999657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=n57HNBzN; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=HmvICT2v; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XWprv5VzQz1xwK for ; Mon, 21 Oct 2024 06:48:15 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/EIQAd/8saN7EDFoyfo+LmCb+QYZTauP5LYJ0fcCySA=; b=n57HNBzNzLbWOU PhjcSETh05Y16OY3sREJChCwy1aBQ5DKVkH6mRRAeoP/boW9wcfGoAnSzQI1t5VB8fVtbqPbGklfQ dU9+84cTzqpHTTMGDTclRGrwlrG5Gj15r0GnNrysXpFvZQLQ/xa+7RfQK3yagwIQ5R7PcZbACFPXZ s4VkWTfMskg2jNjU+JxjZAOSt6wfcxBCzl8VjV+Uj4dBNZzyTabzvNLFQhbXITEb2rdMiX02gMt62 nlgQoEnxZjRL0ojEhsUvOYvox1BnrAH0hSIJU8XspzmbMGghAX9px9u1OEsVbMM+X3ESH8V6jw3T3 TJ4Errnss0qDOBsZS1CQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2buQ-00000005Mzp-0Er7; Sun, 20 Oct 2024 19:48:14 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2bu7-00000005Mjg-2cvR for kvm-riscv@lists.infradead.org; Sun, 20 Oct 2024 19:47:58 +0000 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2e2a97c2681so2762038a91.2 for ; Sun, 20 Oct 2024 12:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1729453675; x=1730058475; darn=lists.infradead.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=160oEn3Hw+w/iZ7EFhTc6TJAcZCL3iOZo0psz4xgbB0=; b=HmvICT2vWRR7AaF7bpBVj5iFtdo/uNItZTIDpUgl2+O9RCZMaeA4V99lXO4WwlYB8b LI/EvJq9hmQAmsimc8JOyMMEb2YwnhOdmwGELx6iqWRa87JyUn3tTMgjMhCRnb0Ur/49 ndnEkRIUNrliaf9V01emgYASx/IGIdQX3yrZ3zrFkeIJOHFhTYvBUzPoRkdox1fNw3s2 F8Hq8s+ExyPQhM4FSGgO6hYR/qLg6f4EJk4Zv8iRDYzoNDRDMkBQtNiZ8Lo6BlHiYvXz +A37mJlavCU+jOICGyfKPRRXAWdIMUPRShOX//D2/MtC4oYwkfmXvXEqwvKEIYyCCJtq dRrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729453675; x=1730058475; 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=160oEn3Hw+w/iZ7EFhTc6TJAcZCL3iOZo0psz4xgbB0=; b=blx0ZnINxP7sW91/TMWU7A1sqYn8DKTG0cottKKK8syFH3GSzAnrsYACPcoevD9vMl sTMlMQYsehZeiMM3IqoOm3BV/FI2sOzyCuMTruljnq32RaGhWVBlut1ATHb8UJOMZsUd N85CV0lQN9C5kzTO0tEyp8F7g2MIJJJVqPITKCWEmZgeapgrJ39FKw8LHdkJNsb/QWJv 2ozNgey7/AO8CXGTkl3Q/ShouD7yY4n1D381EkecNKO9uRNvVWqf62ZINWhpQssQ/OOt 0k/c0Bjd2b4qzIf4dUeetNtblYYQdgLUtGwn1ZfkebgPKsyS4Z0oL5+GygF1pf42oy+W evKQ== X-Forwarded-Encrypted: i=1; AJvYcCURRqeN1PfSUf8jIgHMah0pi7DllH1YITtFeAaKB0KOKygChtBlJZ8JPpBwYbRueXOKs2DenXlTTCA=@lists.infradead.org X-Gm-Message-State: AOJu0YxWtIbu29HehMztfGjDF66quuFTE/h94YiCn+8MRK3Qg6xTXTpf yViDXok0B04dUBuS458QnQCpUNZgf/lb+oj3DRyc3Mj3bmuWJ6C2kDzm8X6yOavY/GuB8JgJTd1 ATj/86A== X-Google-Smtp-Source: AGHT+IFjSRTaADFfRKm/pM//eGuPDafKddIxjEZ6I/KXrnokbyilNV7LBvfBGmNKmpBhs1ancwD0CA== X-Received: by 2002:a17:90a:ab0e:b0:2e0:74c9:ecf1 with SMTP id 98e67ed59e1d1-2e561718d7amr7870206a91.10.1729453674952; Sun, 20 Oct 2024 12:47:54 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([50.238.223.131]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e5ad365d4dsm1933188a91.14.2024.10.20.12.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2024 12:47:54 -0700 (PDT) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley Cc: Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel , Atish Patra Subject: [PATCH v2 06/13] RISC-V: KVM: Don't setup SGEI for zero guest external interrupts Date: Mon, 21 Oct 2024 01:17:27 +0530 Message-ID: <20241020194734.58686-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241020194734.58686-1-apatel@ventanamicro.com> References: <20241020194734.58686-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241020_124755_869205_A5B27A6E X-CRM114-Status: UNSURE ( 8.97 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: No need to setup SGEI local interrupt when there are zero guest external interrupts (i.e. zero HW IMSIC guest files). Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/kvm/aia.c | 9 +++++++++ 1 file changed, 9 insertions(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:102a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org No need to setup SGEI local interrupt when there are zero guest external interrupts (i.e. zero HW IMSIC guest files). Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/kvm/aia.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/riscv/kvm/aia.c b/arch/riscv/kvm/aia.c index 17ae4a7c0e94..8ffae0330c89 100644 --- a/arch/riscv/kvm/aia.c +++ b/arch/riscv/kvm/aia.c @@ -499,6 +499,10 @@ static int aia_hgei_init(void) hgctrl->free_bitmap = 0; } + /* Skip SGEI interrupt setup for zero guest external interrupts */ + if (!kvm_riscv_aia_nr_hgei) + goto skip_sgei_interrupt; + /* Find INTC irq domain */ domain = irq_find_matching_fwnode(riscv_get_intc_hwnode(), DOMAIN_BUS_ANY); @@ -522,11 +526,16 @@ static int aia_hgei_init(void) return rc; } +skip_sgei_interrupt: return 0; } static void aia_hgei_exit(void) { + /* Do nothing for zero guest external interrupts */ + if (!kvm_riscv_aia_nr_hgei) + return; + /* Free per-CPU SGEI interrupt */ free_percpu_irq(hgei_parent_irq, &aia_hgei); }