Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp206919lqo; Wed, 27 Mar 2024 10:41:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV91qx/nAn8S1zSoqYeUmigNV6QkiNwHNgiNZJmNzMU9pLSjAs8DfO0LfSS/OpGw8yWuM8lKiQDoPzMVuEXZe0yMNrbxEuH8gr6dnKW4w== X-Google-Smtp-Source: AGHT+IHJv0WzeNcb1sNUCOtECvxxR7r693mcWy3aKsaJs0S8HrAytL/lGbyYWx8Qz4tR02Fry+x7 X-Received: by 2002:a17:90a:ab90:b0:29f:f6c7:1ace with SMTP id n16-20020a17090aab9000b0029ff6c71acemr321027pjq.32.1711561289518; Wed, 27 Mar 2024 10:41:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711561289; cv=pass; d=google.com; s=arc-20160816; b=fu7Gf4Dwv9Y05PIEKcIEcIPTJYwymhzIh8qXw0VJjsNoQ9Saz5QuvwR2M1jIDE7vz6 /Y8hg34DMwpj5xh5gVFLBdKWlcvBYxA0sukdipxRmQCiFVmu1kVxFendgVV+YLz9l6Vv U461/x2nYd46bveSQP3x+fyzsi8cJo5zP1vHJ+B3ix8KHxiGEViKlXPly1s23/DVpmo7 ZvxJo4rGSF2hkf4l49M2l3bC6UYqgBu3E/Uf/tq4MjgFfRVE+/t4gt0WJeTTpTmx2Sby Dz9X1WHZIa8qLp5J9VQXqIwAy2ASoCmAotXTcvNDd1xRaszH9wDW/Ahe+jbiMQj+DtrY oVpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=EMtnIDGBWoSo9Ry3BeKJRN8rESCnIw6UO5o6Hfsmt5o=; fh=1ARVOQzWxOr+ItXO76UA1EOEwrWFWbSrKT9+vhR6TY0=; b=sgp6+HHSInvH4B49BCphc91TlsvRi3xWp7tYJamg72rU5KoiXNEck1wkTbQJ8PWIga YUHZlIOZz0tiYtVG77FeNFPAl8QSfz5sEze2kLmGUwvNTS4XBRc3IyD0kZWCAfaoCtE8 C3IYFuKhSRThVssrG+XLmc0n3aZfJ5V0ui3cySa3CYZTWmimQy7/4EqVLPLWLwjxYBwc /VsMV+nXSZKyvCpIqfsMMXsj3Mu4BJe129fcMl8/g1i+rpDTm+dMFDElmSUOkDkFVsYc 55Gatv2j+UaBJXEH0eEtQ7JKVvi4nTi0M+PNbBav/nyWuJSs6J2Yiyc5zkXlTGX1teho 0pew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="aycjg/sz"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-121710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s17-20020a17090aa11100b0029ba9205138si1864996pjp.54.2024.03.27.10.41.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 10:41:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="aycjg/sz"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-121710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 20286299BA3 for ; Wed, 27 Mar 2024 17:41:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47CBB14E2CB; Wed, 27 Mar 2024 17:41:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aycjg/sz" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 888E812E1F0; Wed, 27 Mar 2024 17:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711561280; cv=none; b=FwfM+2xE4MC7W3ROgMRHlMSAS8RZ8OBVirGIeS1RXjaEZNUpR2I9I9ineIZo3QCzazmbau/rOVUA5GeRpCsXoXTej5tvoPqwr5t4i/1MRAFPA8BU51O12ZVG7loZN2mI6LKOzemfRKkpw/5Q6m4Cxh82buNJgnBQ0qWGQ+Es9/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711561280; c=relaxed/simple; bh=CgrYWenITCZVs5rgxOkYDcWumcyCEq1xPoUasY+8V8Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jE3ttxVbnjoItEkCKsGKSBokQ3aDPW++O0WvtLl1NcR5GwyYuCEOWyg6U23fiE8V34ubL5GOdehVCyyGRP2Gyb7j2JjCNij0PxCM53ho9oWRwAERTdButB/33JGv2JH2iNdvhRcIJMIIVlC+nroA8/j3XGFqEPRsYBqAClLl6RQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aycjg/sz; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711561279; x=1743097279; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=CgrYWenITCZVs5rgxOkYDcWumcyCEq1xPoUasY+8V8Q=; b=aycjg/szt+05QwBPrT3JrrdbwtjnTCs1Y80eygq7DsVjuBi2KprJr64O 3KY3CfqDdur7L541bSmQZpWw0l5u7MrG8RsgTEzU/L+qu0GeZkPcNslFd w+JGlxYvYcqc8EdpdTtDUsJP8Njm/tbe6QmqnZXP8t/WFShq7mRZYmD9T DEflWyDvEC2hMxB7uKrpPP9xv5ZcdSRTEnxiIKX4DnM7ZQ2v1s7KA/TMV BDuclb0rT+erni0nt5E42/dCS7UDwnNnIeeHK8vy2LF/ofm2vYV1Un8r6 hR7QOujIyqq0i1+7pyDnj/+yFG+4FRRygt6SYhVqgq3wbVEu3heHCp9wH A==; X-CSE-ConnectionGUID: z3f/mZQMR1yMB6t7zZwYhw== X-CSE-MsgGUID: BE1/EEVfRiCxDJe2Wkc0DQ== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="17824937" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="17824937" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 10:41:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="16998217" Received: from djiang5-mobl3.amr.corp.intel.com (HELO [10.212.56.222]) ([10.212.56.222]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 10:41:07 -0700 Message-ID: <4e24a03c-f557-4323-a836-ed01f72a3055@intel.com> Date: Wed, 27 Mar 2024 10:41:05 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 12/26] cxl/pci: Factor out interrupt policy check Content-Language: en-US To: Ira Weiny , Fan Ni , Jonathan Cameron , Navneet Singh Cc: Dan Williams , Davidlohr Bueso , Alison Schofield , Vishal Verma , linux-btrfs@vger.kernel.org, linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240324-dcd-type2-upstream-v1-0-b7b00d623625@intel.com> <20240324-dcd-type2-upstream-v1-12-b7b00d623625@intel.com> From: Dave Jiang In-Reply-To: <20240324-dcd-type2-upstream-v1-12-b7b00d623625@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/24/24 4:18 PM, Ira Weiny wrote: > Dynamic capacity devices (DCD) require interrupts to notify the host of > events in the DCD log. The interrupts for DCD may be supported despite > FW control of memory event logs. > > Prepare to support DCD event interrupts separate from other event > interrupts by factoring out the check for event interrupt settings. > > Signed-off-by: Ira Weiny Reviewed-by: Dave Jiang > > --- > Changes for V3: > [iweiny: new patch] > --- > drivers/cxl/pci.c | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c > index ccaf4ad26a4f..12cd5d399230 100644 > --- a/drivers/cxl/pci.c > +++ b/drivers/cxl/pci.c > @@ -738,6 +738,21 @@ static bool cxl_event_int_is_fw(u8 setting) > return mode == CXL_INT_FW; > } > > +static bool cxl_event_validate_mem_policy(struct cxl_memdev_state *mds, > + struct cxl_event_interrupt_policy *policy) > +{ > + if (cxl_event_int_is_fw(policy->info_settings) || > + cxl_event_int_is_fw(policy->warn_settings) || > + cxl_event_int_is_fw(policy->failure_settings) || > + cxl_event_int_is_fw(policy->fatal_settings)) { > + dev_err(mds->cxlds.dev, > + "FW still in control of Event Logs despite _OSC settings\n"); > + return false; > + } > + > + return true; > +} > + > static int cxl_event_config(struct pci_host_bridge *host_bridge, > struct cxl_memdev_state *mds, bool irq_avail) > { > @@ -760,14 +775,8 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge, > if (rc) > return rc; > > - if (cxl_event_int_is_fw(policy.info_settings) || > - cxl_event_int_is_fw(policy.warn_settings) || > - cxl_event_int_is_fw(policy.failure_settings) || > - cxl_event_int_is_fw(policy.fatal_settings)) { > - dev_err(mds->cxlds.dev, > - "FW still in control of Event Logs despite _OSC settings\n"); > + if (!cxl_event_validate_mem_policy(mds, &policy)) > return -EBUSY; > - } > > rc = cxl_event_config_msgnums(mds, &policy); > if (rc) >