From patchwork Mon Oct 10 22:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 13003304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91936C433F5 for ; Mon, 10 Oct 2022 22:43:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229436AbiJJWnK (ORCPT ); Mon, 10 Oct 2022 18:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbiJJWnH (ORCPT ); Mon, 10 Oct 2022 18:43:07 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D42066A4F; Mon, 10 Oct 2022 15:43:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665441786; x=1696977786; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TcEJ7wbxfjNB+eaSwMkMs0VQ6oiJbVp1r0I0LqEARfg=; b=VRF8fLhvsIQLhCCMp0lj6+1EUHQZD0vHR87fa95omvihkeMBhGxSTNKx IGCbab8E0wokr6N3u03nKTs1Y+IiO/FuKFxg8vx14a3XKwiXbOZisecSW BGDDKLoCrRRD+b45abFAUxBypC7ywtTVlFOGDYsyciQnLAmRubR/15gka HETVwZsgoT3VFWhTj9v5bq26VxhY7vqqEEBQQ1XeDy8wkTLmrwxeOhkAh ZthasWJ8zIx94hNO+e3F4Yv/sgnWjghOK/UqOXoIf/8FjCrEKLXkvReG8 exntcmJZrvQ3TpznqiZTQeCOAxj8M1dzgn9iluiZrzArBw56/DTEnIWCv Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="287615381" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="287615381" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 15:43:06 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="621191356" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="621191356" Received: from iweiny-desk3.amr.corp.intel.com (HELO localhost) ([10.252.141.94]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 15:43:05 -0700 From: ira.weiny@intel.com To: Dan Williams Cc: Ira Weiny , Alison Schofield , Vishal Verma , Ben Widawsky , Steven Rostedt , Jonathan Cameron , Davidlohr Bueso , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org Subject: [RFC V2 PATCH 04/11] cxl/mem: Clear events on driver load Date: Mon, 10 Oct 2022 15:41:24 -0700 Message-Id: <20221010224131.1866246-5-ira.weiny@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221010224131.1866246-1-ira.weiny@intel.com> References: <20221010224131.1866246-1-ira.weiny@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org From: Ira Weiny The information contained in the events prior to the driver loading can be queried at any time through other mailbox commands. Ensure a clean slate of events by reading and clearing the events. The events are sent to the trace buffer but it is not anticipated to have anyone listening to it at driver load time. Signed-off-by: Ira Weiny Reviewed-by: Jonathan Cameron --- drivers/cxl/pci.c | 2 ++ tools/testing/cxl/test/mem.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index faeb5d9d7a7a..5f1b492bd388 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -498,6 +498,8 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (IS_ERR(cxlmd)) return PTR_ERR(cxlmd); + cxl_mem_get_event_records(cxlds); + if (resource_size(&cxlds->pmem_res) && IS_ENABLED(CONFIG_CXL_PMEM)) rc = devm_cxl_add_nvdimm(&pdev->dev, cxlmd); diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index aa2df3a15051..e2f5445d24ff 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -285,6 +285,8 @@ static int cxl_mock_mem_probe(struct platform_device *pdev) if (IS_ERR(cxlmd)) return PTR_ERR(cxlmd); + cxl_mem_get_event_records(cxlds); + if (resource_size(&cxlds->pmem_res) && IS_ENABLED(CONFIG_CXL_PMEM)) rc = devm_cxl_add_nvdimm(dev, cxlmd);