Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp614784pxv; Thu, 24 Jun 2021 15:48:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBz4l+R3D80JMWmObfuy6d8G4qRJj1YX1Qudd9zhKJ7FwMPok4xMiwy/6FKE1sEAV8U9u7 X-Received: by 2002:a6b:f618:: with SMTP id n24mr6040733ioh.174.1624574910948; Thu, 24 Jun 2021 15:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624574910; cv=none; d=google.com; s=arc-20160816; b=YjaFRNltOd6/aeTj+gt7AZA0Cw0Fl7cEHa11SsMly/R+mXeSaveprDAf8fhSfEt1Dt O9bQ5J7kNuTjmxqdREl5ivyfiuJQfIvAjm7Es+tpb+VoKOhDADdWTT3utG2+zp8m98Gr dx8oudLfqr++6pg3GNQS6lJwqfZUaV+EmMYRzcJMVVXWPd/MicdeRuhAOWaWYrasw7sc DeOTOiUjel5wK7vOQ1dR/LhyL4j2GOk4otSdoinR4sYlaDYTeTkxkYnU7FTCqN++IxqM m3VWyd9T2dmZ8a/x70p0BL9FmeUJ/SI7nky/YKTKOJ7scsrMrFc4YsFTsSvKqwbK14Uv KV8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=J8bMIpCW3BzpWdclemfkzp/GR9u6cL8+v0xRpCYAuM4=; b=rUnVc41SjR8UrbRuP+aG9N/ZL5M7LSEZ+CBPzQX7kQUzbMbtEnKwvr1oD9Mjza+Fvr uRtWKrlo5ViBCLwR4VT/dFrBknYa0g4bMypqsjDR3d2XBD0FO8NtkgreQQSJ9jaeTrFX AKacV7sgXf9jr2iYwFtOcOikf/j+VzYZeEMBUd5Li8SA1mmqBI/eW2krya7TYC/O0eE5 NYRHrERrUiOkCRwMvk9Q1motA69LHbiVMfK4SH5+enzPwxjKWV2ZBlDxVIVbkhKkLAhv Vz/lxLMiXxTEkPoven2Vu29GcIbCFdbHjPE1pxEcEia74evSo9oy+iCpw1UQJj4qvtTx 8V7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c4si3929571ilk.14.2021.06.24.15.48.17; Thu, 24 Jun 2021 15:48:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232654AbhFXWt6 (ORCPT + 99 others); Thu, 24 Jun 2021 18:49:58 -0400 Received: from foss.arm.com ([217.140.110.172]:40954 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbhFXWt5 (ORCPT ); Thu, 24 Jun 2021 18:49:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 980F6ED1; Thu, 24 Jun 2021 15:47:37 -0700 (PDT) Received: from [10.57.77.225] (unknown [10.57.77.225]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 595243F718; Thu, 24 Jun 2021 15:47:36 -0700 (PDT) Subject: Re: [RFC PATCH 4/4] ultrasoc: Add System Memory Buffer driver To: Qi Liu , alexander.shishkin@linux.intel.com, mathieu.poirier@linaro.org, jonathan.zhouwen@huawei.com, f.fangjian@huawei.com Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linuxarm@huawei.com References: <1623749684-65432-1-git-send-email-liuqi115@huawei.com> <1623749684-65432-5-git-send-email-liuqi115@huawei.com> From: Suzuki K Poulose Message-ID: Date: Thu, 24 Jun 2021 23:47:34 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <1623749684-65432-5-git-send-email-liuqi115@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Qi On 15/06/2021 10:34, Qi Liu wrote: > This patch adds driver for System Memory Buffer. It includes > a platform driver for the SMB device. > > Signed-off-by: Jonathan Zhou > Signed-off-by: Qi Liu > --- > drivers/hwtracing/ultrasoc/Kconfig | 9 + > drivers/hwtracing/ultrasoc/Makefile | 3 + > drivers/hwtracing/ultrasoc/ultrasoc-smb.c | 663 ++++++++++++++++++++++++++++++ > drivers/hwtracing/ultrasoc/ultrasoc-smb.h | 182 ++++++++ > 4 files changed, 857 insertions(+) > create mode 100644 drivers/hwtracing/ultrasoc/ultrasoc-smb.c > create mode 100644 drivers/hwtracing/ultrasoc/ultrasoc-smb.h > > +/* > + * Coresight doesn't export the following > + * structures(cs_mode,cs_buffers,etm_event_data), > + * so we redefine a copy here. > + */ Please do not duplicate them. This indicates, either : - You need to place your driver under coresight OR - Export the required definitions. > +enum cs_mode { > + CS_MODE_DISABLED, > + CS_MODE_SYSFS, > + CS_MODE_PERF, > +}; > + > +struct cs_buffers { > + unsigned int cur; > + unsigned int nr_pages; > + unsigned long offset; > + local_t data_size; > + bool snapshot; > + void **data_pages; > +}; > + Why does this need to be replicated ? > +struct etm_event_data { > + struct work_struct work; > + cpumask_t mask; > + void *snk_config; > + struct list_head * __percpu *path; > +}; > + > +#if IS_ENABLED(CONFIG_CORESIGHT) > +int etm_perf_symlink(struct coresight_device *csdev, bool link); > +int etm_perf_add_symlink_sink(struct coresight_device *csdev); > +void etm_perf_del_symlink_sink(struct coresight_device *csdev); > +static inline void *etm_perf_sink_config(struct perf_output_handle *handle) > +{ > + struct etm_event_data *data = perf_get_aux(handle); > + > + if (data) > + return data->snk_config; > + return NULL; > +} > +#else > +static inline int etm_perf_symlink(struct coresight_device *csdev, bool link) > +{ return -EINVAL; } > +int etm_perf_add_symlink_sink(struct coresight_device *csdev) > +{ return -EINVAL; } > +void etm_perf_del_symlink_sink(struct coresight_device *csdev) {} > +static inline void *etm_perf_sink_config(struct perf_output_handle *handle) > +{ > + return NULL; > +} > + > +#endif /* CONFIG_CORESIGHT */ > + > +#endif > Suzuki