Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1656562pxb; Wed, 9 Feb 2022 01:22:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbC+n/e9hgrWMjtdaA/4hKOHKSZVW1idsxPSjR+sEz8FoGV7iZhNH5eV0z3odLA6oiT/I/ X-Received: by 2002:a17:90b:100e:: with SMTP id gm14mr1506427pjb.155.1644398555887; Wed, 09 Feb 2022 01:22:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644398555; cv=none; d=google.com; s=arc-20160816; b=I4mSr1jYHH41ITGHEGtzj+wUSpZSMQnR5Emhfk2dNVyFC7NBNnopPoq3o/Vq+hXaaB K/RgEdMjtBDBwpUtL56qnb3WOSylYMC9Z6WmrjdVrTdzqJFXPXluYc/9DPwaDI/oCvfk Riv7NeYHOy7AF8wQRga0aAS2IV3BwrnrMOl8ufHdswwCOZNntOTndO1yGlA/btnD85Wx mr1JeuMsuZObes+ZG0PMIB7UXNZmBkKQTDgTwR/bM3gg4Pl5Bifsgh3g6PJBMbEZnq5s nsq60KEnWom46fscCuD+ZiZPMpcgxQmLyj7PImYaWNWy2MWc2sID9KO+QVkib9qCF7Wc 4nKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=nLTn5eCMfvO9zzjn+4OXeGi3UHLu/Fz1K9ahm2UG+64=; b=ZUPJrEyUC75bOQG4cFNH6hYMLThitgo6kjyKSBO+/vlllHflAOsrs4IO5I5tHcvPik 5KKO2ljM03e8pxmVxvTcV+Z0/KQ1hXM3M1hdKkQ2Jp9eSXw5KJ6SpohivqgcqYNlcCrV Q1KZNpU6OVhdeozO17wU7yXr4ITqwTCnxHDE8id46jsBNTl/WzM5slsyYa5gpYGz4uYi jhvhnEx3kmTr1+GO29xNDJLokOobuRL+P0l6a+cN9sAyycOZjjTv5K2gFNo6FrHP3s9j g0uC0y+MAhUwTZwIkSh/H8r0dhNiou5rwPv+2GS/6SUH/bUO8tJ0nELzuKeVvO5lH07v /4+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mz7si4529167pjb.65.2022.02.09.01.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:22:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8323CE03923C; Wed, 9 Feb 2022 00:56:59 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345323AbiBHBun (ORCPT + 99 others); Mon, 7 Feb 2022 20:50:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344798AbiBHBkb (ORCPT ); Mon, 7 Feb 2022 20:40:31 -0500 Received: from relay3.hostedemail.com (relay3.hostedemail.com [64.99.140.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3EEFC061A73 for ; Mon, 7 Feb 2022 17:40:30 -0800 (PST) Received: from omf14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3E6E02282B; Tue, 8 Feb 2022 01:40:29 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA id EAB782D; Tue, 8 Feb 2022 01:40:12 +0000 (UTC) Message-ID: <103681860759d72b1acf712eed334b1d4ef6b7d5.camel@perches.com> Subject: Re: [PATCH V6 1/3] platform/x86: Add Intel Software Defined Silicon driver From: Joe Perches To: "David E. Box" , hdegoede@redhat.com, gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, srinivas.pandruvada@intel.com, mgross@linux.intel.com Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Mark Gross Date: Mon, 07 Feb 2022 17:40:26 -0800 In-Reply-To: <20220208005444.487209-2-david.e.box@linux.intel.com> References: <20220208005444.487209-1-david.e.box@linux.intel.com> <20220208005444.487209-2-david.e.box@linux.intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamout06 X-Rspamd-Queue-Id: EAB782D X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Stat-Signature: cqp3gnqhxdfm9599fkk1o4kd3ab9ky5j X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/rw6BEZ0kR964qVgcoew+I17VtKpWRSzg= X-HE-Tag: 1644284412-993389 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2022-02-07 at 16:54 -0800, David E. Box wrote: > Intel Software Defined Silicon (SDSi) is a post manufacturing mechanism for > activating additional silicon features. Features are enabled through a > license activation process. The SDSi driver provides a per socket, sysfs > attribute interface for applications to perform 3 main provisioning > functions: [] > --- > V6 > - Replace, > return (ret < 0) ? ret : size; > with, > if (ret) > return ret; > return size > > Besides the style change (suggested by GKH) this fixes a klocwork > warning. thanks. > diff --git a/drivers/platform/x86/intel/sdsi.c b/drivers/platform/x86/intel/sdsi.c [] > +/* SDSi mailbox operations must be performed using 64bit mov instructions */ > +static __always_inline void > +sdsi_memcpy64_toio(u64 __iomem *to, const u64 *from, size_t count_bytes) > +{ > + size_t count = count_bytes / sizeof(*to); > + int i; > + > + for (i = 0; i < count; i++) > + writeq(from[i], &to[i]); Any chance the byte count is not a multiple of sizeof(u64) ? > +static __always_inline void > +sdsi_memcpy64_fromio(u64 *to, const u64 __iomem *from, size_t count_bytes) > +{ > + size_t count = count_bytes / sizeof(*to); > + int i; > + > + for (i = 0; i < count; i++) > + to[i] = readq(&from[i]); > +} here too. [] > +static int sdsi_mbox_cmd_read(struct sdsi_priv *priv, struct sdsi_mbox_info *info, > + size_t *data_size) > +{ > + struct device *dev = priv->dev; > + u32 total, loop, eom, status, message_size; [] > + if (packet_size > SDSI_SIZE_MAILBOX) { > + dev_err(dev, "Packet size to large\n"); too [] > + /* Message size check is only valid for multi-packet transfers */ > + if (loop && total != message_size) > + dev_warn(dev, "Read count %d differs from expected count %d\n", %u > + total, message_size); > +static int sdsi_map_mbox_registers(struct sdsi_priv *priv, struct pci_dev *parent, > + struct disc_table *disc_table, struct resource *disc_res) > +{ > + u32 access_type = FIELD_GET(DT_ACCESS_TYPE, disc_table->access_info); > + u32 size = FIELD_GET(DT_SIZE, disc_table->access_info); > + u32 tbir = FIELD_GET(DT_TBIR, disc_table->offset); > + u32 offset = DT_OFFSET(disc_table->offset); > + u32 features_offset; > + struct resource res = {}; > + > + /* Starting location of SDSi MMIO region based on access type */ > + switch (access_type) { > + case ACCESS_TYPE_LOCAL: > + if (tbir) { > + dev_err(priv->dev, "Unsupported BAR index %d for access type %d\n", > + tbir, access_type); %u here too [] > + dev_err(priv->dev, "Unrecognized access_type %d\n", access_type); and here