From nobody Tue Feb 10 19:00:18 2026 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=1684810172; cv=none; d=zohomail.com; s=zohoarc; b=JXS9ynbRw7EdK4Wx1periobURgfxcSVQYHJh+Q9F61jZOvUuPz0zWDD2PUeN4nONX+LCyjrToN2pxZ4ivTaPiNNzCW8Ni2t2lt+VSx6jg0fuiMo+VeCRWkJ1d0StZqo8WWpodwYitdiMG/oUrijKijrxufhrzrkK9FN9fRJXLWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684810172; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=42hUpLFpyentR+DHl1F+aZnZuTEaFvKzVFAAW2jc9FM=; b=n23m/8XygjUh/yKEE5wzMnlpwyj+Hh1jn9g3sIEUDpuhyH84mcHgzKRyAcGj2b7eGFpJ2BJdAeXjZeb2Z+QPO8y8wovHnDf4niF7JOl+0mzpMGc3WbS+pZrPhVXQyd7K3ZQhT6ty/7/GXDfrTeu7G1lZi2dtK1Q5uptCwKCapEU= 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 1684810172282330.4441163992468; Mon, 22 May 2023 19:49:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1I27-0007JF-7V; Mon, 22 May 2023 22:45:55 -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 1q1I1o-000669-0d for qemu-devel@nongnu.org; Mon, 22 May 2023 22:45:37 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1I1e-0004Um-4g for qemu-devel@nongnu.org; Mon, 22 May 2023 22:45:33 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5346d150972so5039901a12.3 for ; Mon, 22 May 2023 19:45:25 -0700 (PDT) Received: from alarm.. ([157.82.204.253]) by smtp.gmail.com with ESMTPSA id o10-20020a17090aac0a00b002467717fa60sm4769847pjq.16.2023.05.22.19.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 19:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1684809924; x=1687401924; 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=42hUpLFpyentR+DHl1F+aZnZuTEaFvKzVFAAW2jc9FM=; b=Om4EwKanCzYynDfQyZKeHqaYRZi+vXexnEXTYNo8RaA31CvA5uJ2evCaz8bBYlZJEX FqNBHgY5dEDpGazRAFW8YvILZqdCfkI/hJumeMrzpM0WZBBdvWf0Vrf+OhTxozHur2RF R9IUcZPOlsBRVp6D9JFlCzuPlfjGZbT/iaTcnUst7DBJUW1WQsUH6O8yuhFXUfX4QO6o sjXFg3gmCYEzo9IIKYDtq88MRfRk9SGXk1uuj/NJJ4lw0X0h5HP105htnS+iNG365ONL keCv4y7YmxNtAbjA0KBf/s7Az/ssIxyvgKuV+nvQdr+v6NpzcTa/mT1scu4zBpZ8wvDv 3ZLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684809924; x=1687401924; 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=42hUpLFpyentR+DHl1F+aZnZuTEaFvKzVFAAW2jc9FM=; b=Mm9Ht1/D9DIEPfQgBP9Te4lWT9hP3KnsTdOTYGfbfdjHHT9/McbLutC7++c43fX3Fq Oo2hN07bKnFtXRGTF/Rer27vvthCy0pbSuQxbuhzhLljmO2heyfPfZRfix9iqhm35Wdt XD7AQor7voCYkzo5wFaroOfgILVEZ4CqGKCvqPphROud9ELPZVGieVRSGo5m9KDnnGpW plfyRFOu0dOGcVWWny9PXlwN3GHrfJ797P3F7OnfA18MZCPu75omfq67GB51FU1QbV6C 8YA6TqF3aX/ICIdBeXScUkXsqEK5097RTY2ok5H//JDJiklxxTP+k0wXUfi77zseSQ9v /Kxw== X-Gm-Message-State: AC+VfDylQqwdp64Ui8LbKHtHB29lfg1bw+rzOy4uBSMNFjVcgksUbgQ7 CMSDa/nR+EOKvCFz5AlBNDmhEw== X-Google-Smtp-Source: ACHHUZ70Fru1y1EA2qZHviLN1CXKNVZpiSb7yNKAOV4uKG6CIF9LftLOx7Nm2lUoiZpB0ZV29jSxUA== X-Received: by 2002:a17:90b:300f:b0:253:30f9:1849 with SMTP id hg15-20020a17090b300f00b0025330f91849mr11183155pjb.12.1684809924768; Mon, 22 May 2023 19:45:24 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v5 27/48] igb: Clear EICR bits for delayed MSI-X interrupts Date: Tue, 23 May 2023 11:43:18 +0900 Message-Id: <20230523024339.50875-28-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230523024339.50875-1-akihiko.odaki@daynix.com> References: <20230523024339.50875-1-akihiko.odaki@daynix.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: none client-ip=2607:f8b0:4864:20::52c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_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 @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1684810173808100020 Content-Type: text/plain; charset="utf-8" Section 7.3.4.1 says: > When auto-clear is enabled for an interrupt cause, the EICR bit is > set when a cause event mapped to this vector occurs. When the EITR > Counter reaches zero, the MSI-X message is sent on PCIe. Then the > EICR bit is cleared and enabled to be set by a new cause event Signed-off-by: Akihiko Odaki --- hw/net/igb_core.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 20645c4764..edda07e564 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -97,23 +97,31 @@ igb_lower_legacy_irq(IGBCore *core) pci_set_irq(core->owner, 0); } =20 -static void igb_msix_notify(IGBCore *core, unsigned int vector) +static void igb_msix_notify(IGBCore *core, unsigned int cause) { PCIDevice *dev =3D core->owner; uint16_t vfn; + uint32_t effective_eiac; + unsigned int vector; =20 - vfn =3D 8 - (vector + 2) / IGBVF_MSIX_VEC_NUM; + vfn =3D 8 - (cause + 2) / IGBVF_MSIX_VEC_NUM; if (vfn < pcie_sriov_num_vfs(core->owner)) { dev =3D pcie_sriov_get_vf_at_index(core->owner, vfn); assert(dev); - vector =3D (vector + 2) % IGBVF_MSIX_VEC_NUM; - } else if (vector >=3D IGB_MSIX_VEC_NUM) { + vector =3D (cause + 2) % IGBVF_MSIX_VEC_NUM; + } else if (cause >=3D IGB_MSIX_VEC_NUM) { qemu_log_mask(LOG_GUEST_ERROR, "igb: Tried to use vector unavailable for PF"); return; + } else { + vector =3D cause; } =20 msix_notify(dev, vector); + + trace_e1000e_irq_icr_clear_eiac(core->mac[EICR], core->mac[EIAC]); + effective_eiac =3D core->mac[EIAC] & BIT(cause); + core->mac[EICR] &=3D ~effective_eiac; } =20 static inline void @@ -1834,7 +1842,6 @@ igb_eitr_should_postpone(IGBCore *core, int idx) static void igb_send_msix(IGBCore *core) { uint32_t causes =3D core->mac[EICR] & core->mac[EIMS]; - uint32_t effective_eiac; int vector; =20 for (vector =3D 0; vector < IGB_INTR_NUM; ++vector) { @@ -1842,10 +1849,6 @@ static void igb_send_msix(IGBCore *core) =20 trace_e1000e_irq_msix_notify_vec(vector); igb_msix_notify(core, vector); - - trace_e1000e_irq_icr_clear_eiac(core->mac[EICR], core->mac[EIA= C]); - effective_eiac =3D core->mac[EIAC] & BIT(vector); - core->mac[EICR] &=3D ~effective_eiac; } } } --=20 2.40.1