From patchwork Fri Aug 16 14:44:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 13766420 X-Patchwork-Delegate: iweiny@gmail.com Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 A67891C7B6E for ; Fri, 16 Aug 2024 14:45:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723819514; cv=none; b=SP9gldK7vAsOEZzErZXGLXVdS5blylkCoxv7F9S0aQrdPyutvlhRoIaaqTihf4KOzciI/W5o2VsrPATdBwcOZd5X4ZNCI8UbmGzTXoAlhvQZBUEPkBbx2egKJJ10ooLwuhIBUX4ltuUfWk9YlIaNwFxH7VZZ3ycleSpBZfhTgrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723819514; c=relaxed/simple; bh=SWMZ4XkcT3C6EuI3kX3FJrjCNYC9aTWVw08nTrQrMOo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Teoi5Zwx6z27rVzqLobeHCGkQAWwZ0MH5nlPTqkPEMkFZAM62nj/B2l45i9wQLs2svBCcp12kE+UNp5cOGJbLYYKnccU+A2kwKZncCgOYxZ+OjyppX8VgW7TuaZqhlVVnNbpAgAAriaa7NpKGhXFlCW7nxM/c/nI5mUW+qx34gs= 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=WVU8O3TI; arc=none smtp.client-ip=198.175.65.19 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WVU8O3TI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723819513; x=1755355513; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=SWMZ4XkcT3C6EuI3kX3FJrjCNYC9aTWVw08nTrQrMOo=; b=WVU8O3TIroRY+vbM41SAiXx6JNJvFuF2A22G8OECzmAXduW6UkSOG7Dd 6EdT8mTntNfpxFsXFPO0Vj1C1hZO/VFoWtkK9zfKKqkRGj/lut8UvzXgL Fx6H7vyZFQapaXEf+Fmp8VFMVEWdFw4XPyBCx+KBydP+aIH5F0nfvpjtO x/7zjTwkKunlsyQFvAHnnVRn1pbHYcaoZF6ilXGFzezL9gs35M2ZXMitW wfnzVFnhsCTlrxhpOpSKbcuBdP24lY8L0ddaGvIvJC+BPa38sqnRSu5v3 DyzEkXhVFqwvbB+gPcscUcw1ti3kquSuToOA292YNwSHvyKxAAMI0a8Ba A==; X-CSE-ConnectionGUID: CiQNAc0ARpiVnjY7SOoVGA== X-CSE-MsgGUID: t0Gt+BCoRrauAwJkU1wPtQ== X-IronPort-AV: E=McAfee;i="6700,10204,11166"; a="21973023" X-IronPort-AV: E=Sophos;i="6.10,152,1719903600"; d="scan'208";a="21973023" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2024 07:45:05 -0700 X-CSE-ConnectionGUID: fbao3WifRXK0hojIqpLWFA== X-CSE-MsgGUID: BSfHaqHHSve2kdmmWP6ihg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,152,1719903600"; d="scan'208";a="97205562" Received: from iweiny-mobl.amr.corp.intel.com (HELO localhost) ([10.125.111.52]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2024 07:45:03 -0700 From: Ira Weiny Date: Fri, 16 Aug 2024 09:44:23 -0500 Subject: [PATCH v3 15/25] cxl/pci: Factor out interrupt policy check Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240816-dcd-type2-upstream-v3-15-7c9b96cba6d7@intel.com> References: <20240816-dcd-type2-upstream-v3-0-7c9b96cba6d7@intel.com> In-Reply-To: <20240816-dcd-type2-upstream-v3-0-7c9b96cba6d7@intel.com> To: Dave Jiang , Fan Ni , Jonathan Cameron , Navneet Singh , Chris Mason , Josef Bacik , David Sterba , Petr Mladek , Steven Rostedt , Andy Shevchenko , Rasmus Villemoes , Sergey Senozhatsky , Jonathan Corbet , Andrew Morton Cc: Dan Williams , Davidlohr Bueso , Alison Schofield , Vishal Verma , Ira Weiny , linux-btrfs@vger.kernel.org, linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, nvdimm@lists.linux.dev X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723819456; l=2095; i=ira.weiny@intel.com; s=20221211; h=from:subject:message-id; bh=SWMZ4XkcT3C6EuI3kX3FJrjCNYC9aTWVw08nTrQrMOo=; b=P13uGvYyKMQtyAlbewEolO4y1HgS6Mvunxmuo7nrGKYr5Ygihty+uGTw4sJzIWtmpISrwqD/S GZjzTsOQRyQCMDguvPVdQec32njRR1XEwYFWnypvDlm6AWUUoWpWv66 X-Developer-Key: i=ira.weiny@intel.com; a=ed25519; pk=noldbkG+Wp1qXRrrkfY1QJpDf7QsOEthbOT7vm0PqsE= Dynamic Capacity Devices (DCD) require event interrupts to process memory addition or removal. BIOS may have control over non-DCD event processing. DCD interrupt configuration needs to be separate from memory event interrupt configuration. Factor out event interrupt setting validation. Reviewed-by: Dave Jiang Reviewed-by: Jonathan Cameron Signed-off-by: Ira Weiny Reviewed-by: Fan Ni Reviewed-by: Li Ming --- Changes: [iweiny: reword commit message] [iweiny: keep review tags on simple 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 17bea49bbf4d..370c74eae323 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)