From nobody Sun Nov 24 07:22:43 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=1724777048; cv=none; d=zohomail.com; s=zohoarc; b=P8FQx5mu5Jmj34XHROqekknx7LjlPwWqpE80Dgf/jAMyG8lbd08zCNE7Dsg6ftjsIMhn5KnQJCV/EfaDnDdanjspO+/AJ9x19CuZ0aiC96PRam+3GXJr2fBNuCu7p8fyvGzmGZt2v8RiWUGu4+uWJu0ighCD08gDD79Zg4t0yvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724777048; 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=SwvM3S9SiHQZGwR6Xphu333GyFIzsUCvHKvo/gM3elM=; b=eaBu8jhf6Ti3BnNYdCAba/jn/cNIq1dsCtHCSDytwhPozKaT2ZW4Oqadlzjyh7NOPffNMDwXaBECvlW1j564GN7CKcXyrF8k1bUJUC7lMuSQXpaFCmccFBUEQm1J8qmoICuIQrbanizYjmUK2n8LMgYNaOOPBfL6NOBjXhOm8n8= 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 1724777048563774.4959329094269; Tue, 27 Aug 2024 09:44:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sizI8-00020N-W4; Tue, 27 Aug 2024 12:43: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 1sizI6-0001z0-5n for qemu-devel@nongnu.org; Tue, 27 Aug 2024 12:43:34 -0400 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sizI4-0002bA-Ob for qemu-devel@nongnu.org; Tue, 27 Aug 2024 12:43:33 -0400 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-69483a97848so55295467b3.2 for ; Tue, 27 Aug 2024 09:43:32 -0700 (PDT) Received: from fan.. ([50.205.20.42]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6c39a753427sm19658677b3.53.2024.08.27.09.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 09:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724777011; x=1725381811; 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=SwvM3S9SiHQZGwR6Xphu333GyFIzsUCvHKvo/gM3elM=; b=D+r6bASty3JSqkizulYox+0NlZKXkWWnW+N953amK8DjoOyLrcI2/gP+8nL32uKTRf dEumlN5wPtcJGr1K6x3rxCih4b9SxuJUhyCBZteCFCVLL4iVKCPpmTzUbM9TySSvMh9W Q6WZ9cyLF4bk4D1ikiOtK5fE8ZZC9EmtbtuxdkZBvc7gBFQCS5bEnTa5P5ot3DcUfGtF C+pBkz7wVcCSWvmiVWtmY6UR1lk4BmftpKVCUwW38RJzsUmDyUlBuhuzOOBs2+wS0dHn NnmY+YuIo6CdhhcuCrtDrppZGpHuM9vHiy8X+FUM76CBSOkZ50EU5Ak/yGuC4c9fW5ns 9krA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724777011; x=1725381811; 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=SwvM3S9SiHQZGwR6Xphu333GyFIzsUCvHKvo/gM3elM=; b=hig581t2UfHsk0OQPKGANW1ElCz6jD6qXxrBUz3+jVZROiA2KSqeNnluykJfHXRxpq 4whVwvlwb2xVxugh6lC8AupFkUlE5zCRm7UlfdOQBPRHH9ueEES5B6qNspnawIlwXC3X rs8V0bdEDHv4xaY0bF322ALaVVF+7vyrShbZlYLnPQu2QDgpSyf0e8QqSj2FQuL2yjEd ihgXowPJV4V+LxuXy9s97BqGcsodxrQZrMgREAG8duFbnAj1McFabxcBYWxQ0mS5inWM MsNfE9hSP3/k2temEAqcxoowlNFc6UcdFEmEfxx4f5+yi/n0bX2WwmLRn2sqjPpi8Uq4 8CfA== X-Gm-Message-State: AOJu0YwbF/vbr91hTAbgNHxI8CSa3y0P2D7UF6IMh8v1yFF16fy/YYpM PDAa85tTNuaGoUBoDjm3j46OdGvtFAl8oPNfeoe+CjDQbVpx9XzY4e5I8g== X-Google-Smtp-Source: AGHT+IEQC25v7IZbO2OCFRpYtIyH6n2S/Ki0r5sn8cq1TjaJ4jl9KoxzebkxMgz4IGMf6hByZNYfxg== X-Received: by 2002:a05:690c:38b:b0:6c7:a120:e10f with SMTP id 00721157ae682-6cfbbbd4c68mr36358247b3.29.1724777011572; Tue, 27 Aug 2024 09:43:31 -0700 (PDT) From: nifan.cxl@gmail.com To: qemu-devel@nongnu.org Cc: jonathan.cameron@huawei.com, linux-cxl@vger.kernel.org, ira.weiny@intel.com, dan.j.williams@intel.com, a.manzanares@samsung.com, dave@stgolabs.net, nmtadam.samsung@gmail.com, nifan.cxl@gmail.com, Fan Ni Subject: [PATCH 1/2] hw/mem/cxl_type3: Fix More flag setting for dynamic capacity event records Date: Tue, 27 Aug 2024 09:40:04 -0700 Message-ID: <20240827164304.88876-2-nifan.cxl@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240827164304.88876-1-nifan.cxl@gmail.com> References: <20240827164304.88876-1-nifan.cxl@gmail.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::1132; envelope-from=nifan.cxl@gmail.com; helo=mail-yw1-x1132.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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: 1724777050054116600 Content-Type: text/plain; charset="utf-8" From: Fan Ni Per cxl spec r3.1, for multiple dynamic capacity event records grouped via the More flag, the last record in the sequence should clear the More flag. Before the change, the More flag of the event record is cleared before the loop of inserting records into the event log, which will leave the flag always set once it is set in the loop. Signed-off-by: Fan Ni --- hw/mem/cxl_type3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index d648192ab9..e616801c81 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -2060,11 +2060,11 @@ static void qmp_cxl_process_dynamic_capacity_prescr= iptive(const char *path, stw_le_p(&dCap.host_id, hid); /* only valid for DC_REGION_CONFIG_UPDATED event */ dCap.updated_region_id =3D 0; - dCap.flags =3D 0; for (i =3D 0; i < num_extents; i++) { memcpy(&dCap.dynamic_capacity_extent, &extents[i], sizeof(CXLDCExtentRaw)); =20 + dCap.flags =3D 0; if (i < num_extents - 1) { /* Set "More" flag */ dCap.flags |=3D BIT(0); --=20 2.43.0 From nobody Sun Nov 24 07:22:43 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=1724777074; cv=none; d=zohomail.com; s=zohoarc; b=hPNW4amWpG86SrlD7ivdzACFNsi7ai+ddlbGTcIjLYNljPrAtzQCzzTMkOJtn7o1d6Km90u21Oti+R44Y7pAJdS3ZggY70UBlITWNvEuK292PfX81ti7gLlx1KEN9NMBsA8QJ+nohMDdzxk/pSA2XXAqzVMJulPGXQZgfqnjUrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724777074; 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=SEDmyzzxPb/PUKZBhsRmkSdCWD04Zj/XpJE2z0YZDVM=; b=FzMZOTWewwAW1um1vF/8gUzXhslcOs2PJCzkesERif/WbYG67g1Tr60TMHUKQ5KK2J0p/JEWJuJIcvyDqCOHNwuu9LsuhyAs7cBOfoex/1jovbbEDq9aYMxm+MVx782NsQ3ufvMpKKabI4LNl6WMZRCwZqilD8P4vZc02EpTB2A= 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 1724777074726220.57145616462037; Tue, 27 Aug 2024 09:44:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sizIB-000299-5Z; Tue, 27 Aug 2024 12:43:39 -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 1sizI9-00020x-3y for qemu-devel@nongnu.org; Tue, 27 Aug 2024 12:43:37 -0400 Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sizI7-0002bN-4f for qemu-devel@nongnu.org; Tue, 27 Aug 2024 12:43:36 -0400 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-6cf6d1a2148so15385297b3.3 for ; Tue, 27 Aug 2024 09:43:33 -0700 (PDT) Received: from fan.. ([50.205.20.42]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6c39a753427sm19658677b3.53.2024.08.27.09.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 09:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724777013; x=1725381813; 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=SEDmyzzxPb/PUKZBhsRmkSdCWD04Zj/XpJE2z0YZDVM=; b=C/GyFW5vm1Bk4Fx4TbURMYQ6S6Hy/P+2FzKfh+UymqEjWIDI7OQxEFK5+dNxRxKo4D TF8N9Cduq6IWwpFAdDVI+buNju/wp/Rsr3WYIXm+qC4UTFPItHFTanRrC/6ZccdA875Y ISL5gxVUBdGpHQ1SZohAZNaRCzFV7a06Aa/nKtPm30tgt625nRK5BQKQWnw4oWm/c8ZS 3GWk8uSX1jKS49usMKHFSyZNU5zAdePlSmJyBnIj8rMFA6gMaT5SbKkzLX7mgB2dM3Ox a2yqb3uG9MY/RTGxT8edBZgYjI37nIrLN41zSrCkAvXNOvt5l9PFzgBr/KrfWOHH88N+ 7fCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724777013; x=1725381813; 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=SEDmyzzxPb/PUKZBhsRmkSdCWD04Zj/XpJE2z0YZDVM=; b=aS/d0/zp8afrdUmfwxne4fFuHRiCLY27FvtzanG3sF0Gq63OYwskFMJSx8OHKyTPS/ Vn0d8FaqDtIAFNnpjJnrp/AJmvtXUJ6j2gF5SDJV3QID1U0X96C6DbhJpv1K12GR13rl XkigMf2qdCTbwDBHkQllHIN4vb4b+otti9jMGSI2CIyHZFtKDgaJb3lVqCN/jWb78a2E I93XUsz+loQ9b/1dAnwOISPOBmrbPkdxX8ps1HFgRk4NVUn/KAHhoY5A2k1Nou3ZAueI Nr5p4edGYJ05jns5MfCkSSD3ppjxperBEzV/3MNSJ95KMbJMmFllFnvayDjN5lN8lA1A 5ZZQ== X-Gm-Message-State: AOJu0YxdZRDZp+5wDrfdtCkQFGjoh0EwqoS092ZCFujU/6t0dU+kIU1K I1/aa201jvp+ZvDv61fG5ARHNcFzzDfA54qeHYtWN/Mq8zOFlK+Ljv+9mg== X-Google-Smtp-Source: AGHT+IE59fdXqmAKT5SobODemnTv9LGfPiVyfZ/eERHVawp27GQyG7XsRqmn6J6DUFuJLAws4UCzQQ== X-Received: by 2002:a05:690c:7005:b0:64a:5493:e0bd with SMTP id 00721157ae682-6cfbc1a8a0emr40365047b3.40.1724777012771; Tue, 27 Aug 2024 09:43:32 -0700 (PDT) From: nifan.cxl@gmail.com To: qemu-devel@nongnu.org Cc: jonathan.cameron@huawei.com, linux-cxl@vger.kernel.org, ira.weiny@intel.com, dan.j.williams@intel.com, a.manzanares@samsung.com, dave@stgolabs.net, nmtadam.samsung@gmail.com, nifan.cxl@gmail.com, Fan Ni Subject: [PATCH 2/2] hw/cxl/cxl_event: Fix interrupt triggering for dynamic capacity events grouped via More flag Date: Tue, 27 Aug 2024 09:40:05 -0700 Message-ID: <20240827164304.88876-3-nifan.cxl@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240827164304.88876-1-nifan.cxl@gmail.com> References: <20240827164304.88876-1-nifan.cxl@gmail.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::1131; envelope-from=nifan.cxl@gmail.com; helo=mail-yw1-x1131.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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: 1724777077444116600 Content-Type: text/plain; charset="utf-8" From: Fan Ni When inserting multiple dynamic capacity event records grouped via More fla= g, we should only trigger interrupt after the last record is inserted into the event log. Achieving the goal by letting cxl_event_insert return true only for the insertion of the last dynamic capacity event record in the sequence. Signed-off-by: Fan Ni --- hw/cxl/cxl-events.c | 8 ++++++++ include/hw/cxl/cxl_events.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/cxl/cxl-events.c b/hw/cxl/cxl-events.c index 12dee2e467..90536c0e68 100644 --- a/hw/cxl/cxl-events.c +++ b/hw/cxl/cxl-events.c @@ -135,6 +135,14 @@ bool cxl_event_insert(CXLDeviceState *cxlds, CXLEventL= ogType log_type, QSIMPLEQ_INSERT_TAIL(&log->events, entry, node); cxl_event_set_status(cxlds, log_type, true); =20 + /* + * For dynamic capacity event records grouped via More flag, + * Only raise interrupt after inserting the last record in the log. + */ + if (log_type =3D=3D CXL_EVENT_TYPE_DYNAMIC_CAP) { + CXLEventDynamicCapacity *dCap =3D (CXLEventDynamicCapacity *)event; + return (dCap->flags & MORE_FLAG) ? false : true; + } /* Count went from 0 to 1 */ return cxl_event_count(log) =3D=3D 1; } diff --git a/include/hw/cxl/cxl_events.h b/include/hw/cxl/cxl_events.h index 38cadaa0f3..b0e5cc89c0 100644 --- a/include/hw/cxl/cxl_events.h +++ b/include/hw/cxl/cxl_events.h @@ -170,6 +170,7 @@ typedef struct CXLEventMemoryModule { * CXL r3.1 section Table 8-50: Dynamic Capacity Event Record * All fields little endian. */ +#define MORE_FLAG BIT_MASK(0) typedef struct CXLEventDynamicCapacity { CXLEventRecordHdr hdr; uint8_t type; --=20 2.43.0