From patchwork Wed Oct 11 10:07:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 731924 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp316564wrv; Wed, 11 Oct 2023 03:10:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGecJW6YVduT0cuZxkUvTKlt0q7VLqNeDZpVz/fbgEMO6KySAl77wB/8khPV8h42dgjp6GF X-Received: by 2002:a05:600c:468d:b0:407:4944:76dc with SMTP id p13-20020a05600c468d00b00407494476dcmr8007774wmo.20.1697019050755; Wed, 11 Oct 2023 03:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697019050; cv=none; d=google.com; s=arc-20160816; b=SYBv+O+q+b7GnCR4F0vNSMpEUifGYp4353ESCQz+kjGgyHzt3pIl1TN7974Hia91W8 gNlD43nWXTZnSZ9D5DFYNTcdE8DB/IteSI9M8EhiuItA8JWYkSeMmU5b2ZTZRmY5zFgF XP9dE6EtRNPgbB6HxnJExnzBbkTv5xihBjV2ewZUKpkVv0Wxvc4nPGo16oU4LdfcASHE 77baXnEWgY66HZpZLHgJWiSWdNxvul2vXOvoErpVDPSWNppTDTTqR8gzOVhBxAE20zJu rXpFK0ox83BAZkAE/iOzlSs7e3yJFK8C4PLJOV8yxN9iPGUqRH3EJQuzoqYr2wL8sBwu Jqkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=elX7B9lHvziN8IPqrJUEHKLzx5CF1FboA+ePTZUlIak=; fh=+s9SE2w9oguEKAMcR35TXtqntCOeVFhiK9u/Kju91lo=; b=phVPDYU64syYVcfMxzv9D5pGp4sGxdcntDIh8eVJ2d3GY7NjGvuwWkPxZIdYPWULrX Qab4Xrbq7oW9IgmmQeTeI/6VhKDEmUf6xwkaaORP8NbpgvysShEK4yEKYYaCFSvl72iZ GOT4iU+cfoBPFKJbNBKIVtw5UMW6YiYNp/xmGSDiBCXzzlpJN5kz23i+9ZFpElajRhcj 8hlp5lj2eB6vmMHhKWrLTzks9HALAiRrPAuIrfnLacpKbaHXZPw4cs8gKw6gGkhC+olC X/HZ1T8cwTZfSAmLcLixbeggtfKithZXz8TnxJlvQQS1/zOUsThdwRbsV9HMg9Invch9 Xm8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=paBxZM4t; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id s7-20020a7bc387000000b00401261d3455si7384629wmj.61.2023.10.11.03.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 03:10:50 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=paBxZM4t; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A03E86DFD; Wed, 11 Oct 2023 12:08:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="paBxZM4t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AB99786DE7; Wed, 11 Oct 2023 12:08:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 864DA86D20 for ; Wed, 11 Oct 2023 12:07:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3a707bc2397so977839b6e.0 for ; Wed, 11 Oct 2023 03:07:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697018862; x=1697623662; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=elX7B9lHvziN8IPqrJUEHKLzx5CF1FboA+ePTZUlIak=; b=paBxZM4t5Mz8x7ApK+ULS/0+KPuI5U9E8D8Sx1MhYVJbDY4yhUiFmgIXu4UTyCDPyw mOZdi4hlVJMWfun+bZzVH/JP6t/itNJfsm7GN/vTmbI9TwDYvGCyfIt0HJAY62Osi5hU EQHpCv48kVKuX1y6CeIsKlvrwMpHbF8eIhXuz3QnboVUNU1CAlCndrAZRYqEx1cw6x6O h6FLNgW5zAeMmPqd6orqd6I1tnfBPEeOn/WGqg8+HUMul4vOuPB7oY7SJHaztM/zJBMJ ZrVuZyHonnVsz4J9WQxvVD7yAfWXET+pWPmdlFLpcJJyzzDr1AO0qYXLh3nq29Zfy+Ym 7bLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697018862; x=1697623662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=elX7B9lHvziN8IPqrJUEHKLzx5CF1FboA+ePTZUlIak=; b=AcNx4HOUA5POpULoxrqgmlf37Q6wSMXqoWsPO956UjqAp9f331fDtIjI61GXBIQuah rY41D9ntNJk96YbhQjE//lW10N1GrvIRhPbqwJE2u6UfJQwpc+0LqxdFJNnlghmj5TG4 TpRBb4YQVYWKnQANjT48Yp14qslmHdxpqCxK2HztiCvjMQGyfzJ1g0BUIZzpRTG0C87/ PTodK+bOzi9XOf0odegLiUnCZU/rekziaeuvRlCNq1ZBOsFSEF9+3LnvLCxlHjRpmx9Q vYc/adPbQWcFFFZwCBmVwqNptKC2eA4qzt4uX5lEilrKTpcR6El3SRyb3ONT6COtOOXm hz7w== X-Gm-Message-State: AOJu0YyyGfdNAvWHtJ4AlNfri94qot6X+v37VZmLVlRRm7CSvaEzP08L piX1nmEUpfomuORD8r7W/2HLDw== X-Received: by 2002:a05:6359:b9a:b0:147:eb87:3665 with SMTP id gf26-20020a0563590b9a00b00147eb873665mr16337393rwb.3.1697018861985; Wed, 11 Oct 2023 03:07:41 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:5c6c:b11a:476c:8ebb]) by smtp.gmail.com with ESMTPSA id e4-20020a62ee04000000b006889664aa6csm9663358pfi.5.2023.10.11.03.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 03:07:41 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com, sjg@chromium.org Cc: etienne.carriere@st.com, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v6 08/14] firmware: scmi: add a version check against base protocol Date: Wed, 11 Oct 2023 19:07:01 +0900 Message-Id: <20231011100707.1007417-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011100707.1007417-1-takahiro.akashi@linaro.org> References: <20231011100707.1007417-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean In SCMI base protocol version 2 (0x20000), new interfaces, BASE_SET_DEVICE_PERMISSIONS/BASE_SET_PROTOCOL_PERMISSIONS/ BASE_RESET_AGENT_CONFIGURATION, were added. Moreover, the api of BASE_DISCOVER_AGENT was changed to support self-agent discovery. So the driver expects SCMI firmware support version 2 of base protocol. Signed-off-by: AKASHI Takahiro Reviewed-by: Etienne Carriere --- v6 * new commit --- drivers/firmware/scmi/base.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/firmware/scmi/base.c b/drivers/firmware/scmi/base.c index ee84e261945a..1d41a8a98fc6 100644 --- a/drivers/firmware/scmi/base.c +++ b/drivers/firmware/scmi/base.c @@ -481,6 +481,7 @@ static int scmi_base_reset_agent_configuration_int(struct udevice *dev, */ static int scmi_base_probe(struct udevice *dev) { + u32 version; int ret; ret = devm_scmi_of_get_channel(dev); @@ -488,6 +489,13 @@ static int scmi_base_probe(struct udevice *dev) dev_err(dev, "get_channel failed\n"); return ret; } + ret = scmi_base_protocol_version_int(dev, &version); + if (ret) { + dev_err(dev, "getting protocol version failed\n"); + return ret; + } + if (version < SCMI_BASE_PROTOCOL_VERSION) + return -EINVAL; return ret; }