Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4141151pxk; Tue, 8 Sep 2020 11:41:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyreGamtO46ESS0thw95/PM8eYfUlionzCnvumf//YJu4gEIPv4x7Y4JhqQEjVfw8LfLhGC X-Received: by 2002:a17:906:ce30:: with SMTP id sd16mr26961928ejb.53.1599590515194; Tue, 08 Sep 2020 11:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599590515; cv=none; d=google.com; s=arc-20160816; b=uIZbpodTacTDCanUlkW7/pN+AE9oRdqxHryEUJSZln3wF35pkV5K9PbMhm/fL4ENrn k+jSIy/I3l5ETL7ly309Qvof7jbHrMSL7uKvxMzGooj0XP1gudBF0Xj0krOXeNgUbtVy 09sj04zKMUx3UwFv17m6zZ9iXxuxuaPhDxr44jyOtaSkpLBQmIHPCrRmd7ZpQzGZwEyS IHm9CP87wiO7DKD+ZpP+pkEHQ1ckXIK7nvizWk8bOgJlVa7eSO2wf6O+7cu4WFR7RzXX 3Y2CeW+sywwl7QO3rC+UnVyUullj23oKNGTyMOYK5mgyScQX6GLOy6cgzWU0XSHIxuy1 I7Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UIEEZoBd3GgyhWJ+8CC98NHevuvchdjoxXFaaAmLl0k=; b=GaJfIlo7oWOJbodZJOJyu1rZy8IGq8Iz5X9BBNa5GXXTQwILpbEF9ZfYWNl6BUPUaE TwRU3515JpKDDvk3NxfrfnI0bYga9bt3jHeu88oPO4KJNXH97czoOkx5BqGFnaO31jlw 63ScRWRyoK/zyL2zKl9GTXhWtVOdF6VcUyAF3aPr7KCXKbcyUbKKUZVuT1IFmmjBPGoE lp+1eayMPfAhSowJhETqJNO/Em4JbwPShAJEAuNLFHU0q5OFzeRPlf8/9C2a46bhFpWY 89wOU4CkVV8tRoIfbSTRLWT5UHbGBXcYUHtIJBzFvsn8c85QsvM1v9hP93hBkQXTZcov gj0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eUtI3dSS; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f13si4979433edc.249.2020.09.08.11.41.32; Tue, 08 Sep 2020 11:41:55 -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; dkim=pass header.i=@kernel.org header.s=default header.b=eUtI3dSS; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731743AbgIHSig (ORCPT + 99 others); Tue, 8 Sep 2020 14:38:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:53536 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731320AbgIHQJA (ORCPT ); Tue, 8 Sep 2020 12:09:00 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1B49824053; Tue, 8 Sep 2020 15:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580108; bh=pTmyHVYbSXnA+BdUOOxYUNHxES5DQpQjSmwTw2AziGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eUtI3dSSCNEdiCDb4RojO042YOsaVLRCtLRLlh+l5wGSvisZ8PmsjSXv9e9kCs/Gs 580Js7xm4IwOmvZ1kAGlRUBA7PKC8v3NdPWcfctgMId+lvMUCDgrFcdgY41FVhFfCc ps9rgtmzFlKLA0QjMzhjdFRugLnVkWqs4GM5MAek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Smith , Edwin Peer , Michael Chan , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 34/88] bnxt_en: fix HWRM error when querying VF temperature Date: Tue, 8 Sep 2020 17:25:35 +0200 Message-Id: <20200908152222.792503974@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152221.082184905@linuxfoundation.org> References: <20200908152221.082184905@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Edwin Peer [ Upstream commit 12cce90b934bf2b0ed9c339b4d5503e69954351a ] Firmware returns RESOURCE_ACCESS_DENIED for HWRM_TEMP_MONITORY_QUERY for VFs. This produces unpleasing error messages in the log when temp1_input is queried via the hwmon sysfs interface from a VF. The error is harmless and expected, so silence it and return unknown as the value. Since the device temperature is not particularly sensitive information, provide flexibility to change this policy in future by silencing the error rather than avoiding the HWRM call entirely for VFs. Fixes: cde49a42a9bb ("bnxt_en: Add hwmon sysfs support to read temperature") Cc: Marc Smith Reported-by: Marc Smith Signed-off-by: Edwin Peer Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 7047f4237ceaf..df3514503dee9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6836,16 +6836,19 @@ static ssize_t bnxt_show_temp(struct device *dev, struct hwrm_temp_monitor_query_input req = {0}; struct hwrm_temp_monitor_query_output *resp; struct bnxt *bp = dev_get_drvdata(dev); - u32 temp = 0; + u32 len = 0; resp = bp->hwrm_cmd_resp_addr; bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); mutex_lock(&bp->hwrm_cmd_lock); - if (!_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) - temp = resp->temp * 1000; /* display millidegree */ + if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) + len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */ mutex_unlock(&bp->hwrm_cmd_lock); - return sprintf(buf, "%u\n", temp); + if (len) + return len; + + return sprintf(buf, "unknown\n"); } static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0); -- 2.25.1