Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp126710rdh; Mon, 18 Dec 2023 13:51:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8lWKprewtDOe9CabyGLHadZxh3te7fCkl9ON9LoPhnOWKEJGhvw1lthwWhgaCBgaraU23 X-Received: by 2002:a05:6402:8ca:b0:553:7635:2590 with SMTP id d10-20020a05640208ca00b0055376352590mr738386edz.50.1702936286422; Mon, 18 Dec 2023 13:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702936286; cv=none; d=google.com; s=arc-20160816; b=auptnP7O+Qv1IQ8aQkrqbkRoAHumSeuJKwNTu7RDE86+OBcmU7a7MxIgkLgQ0z+5We XZl7S5+92osoIWd8afVLMGZDHkDxHQx+jt9/SMgq+ZLHk7xjMJu7g0UcLlH2G24rY5YH +Ydvsd31WFYkyQowS8pjUI5s68TsOOdHNeisxBR3J7jQ8mqGWLubCbjAk4RPSH2oCdF6 6Y4SI7hIQ871xIVTRANtnSNAYBJV54IPFtFewkzMazCrD/a2+QaL9tblVq/AEoP1CU7a gp0KUCAjnlGp/1QbkGY3YJmReM2lkBsCUN9F4rqtQIr2Jrn4BdGLQWJI9Co4ckiSRlwt iIwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=HpqC5fnit+OvETtq6T9wtzXgUHs1FJOABqRcVnmg1Jg=; fh=jBexGrO55vhvvq2ye3cQilFDwDIcGstw6HIWboX++ts=; b=blcP2qHdtPBxgmvVYJXmx5zVLehJ0Ml8/tHiohAD+o9too1HYlPjlQeTQia+gM30wl mzNBNyeJwGBHV0B6tvkMH+vgkBzrjVL0j7dhnbzZ02bE+wOpiFFg0Fz/hmzny9qGx5p4 8aClhBgbtWiMP/pwDYSA1tRZzMFcNQEXlby8W91Vf2GLfInYoJHl5CU/C/tR6Crtt67O vLEJal6kx9WWvflsiKSWcb+udhvuHyjQVqef+wF8Qpw8FFyjev6jS9BSwYCQNkZwcM+j mqBpeXUl7qK7+MBCR3B9j351kHCK7O//rqG0TSoo/4QB9D/G38wFOO9tucWzx6bR3BOw 39tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gp6NBwr0; spf=pass (google.com: domain of linux-kernel+bounces-4426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z3-20020a05640240c300b00550dc574d66si5649665edb.685.2023.12.18.13.51.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 13:51:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gp6NBwr0; spf=pass (google.com: domain of linux-kernel+bounces-4426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6BAF11F24A13 for ; Mon, 18 Dec 2023 21:51:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC7161DA3A; Mon, 18 Dec 2023 21:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gp6NBwr0" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C9FC6FB6 for ; Mon, 18 Dec 2023 21:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2cc4029dc6eso44708101fa.1 for ; Mon, 18 Dec 2023 13:51:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702936259; x=1703541059; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=HpqC5fnit+OvETtq6T9wtzXgUHs1FJOABqRcVnmg1Jg=; b=gp6NBwr09y/Dga1MGMtN+JjH3t5Z1eHDvLdvEGgb6iQNNR2FUeUR0LiJbKcq/nwrFS lzIOiqhTaCW35K7tskKWi0yhkrSOuwmo3vng69NZbSecFBbnUQDO+En+RVdMle4Z7CWN vti4wT7YHiD8JRscQwjbsI6g0dT7pUTi8wyT97nWD6IJSHPsPaV+6njqUiOHTQKSfksl FvNfZgTXp5wMHZCVc0/r59Y856ihFA1y1Op7EYbsvKOCC0+QemihOajUsvi7mVg5HY/x qk9a8hoL34NErSfzRWBiELXwu2KQ9HTF9bgH/G62f4dIk903eXTbyotehffuY3iH6nlT 2b0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702936259; x=1703541059; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HpqC5fnit+OvETtq6T9wtzXgUHs1FJOABqRcVnmg1Jg=; b=OmXGsicZZdN8iMXrazOLfl+AunRl2c5qg/crq8hF4WTUU5HCEQ1AWYPPLp0pZ87Pm8 9waI5FZW+8h4dzhHiMd8cXK4u5A6NkgTm2iSu45WTj6fa4eHS3Duo4TbG7cE/S21eU/5 4CJPU8Hy81R3YUEb+Bpz6ljspuN5eL2FT1jaQyvmNXvWmzHTEZXV94NnQbeaSObsl2v4 jCUQPssswmyb46a5lkoz4wWSuwBenJN7nmDoJuc6ElQay1mg8z+xna7NQDp7SWMiySmQ 3L+KGKkjYFGeNRlKUynBohUlabw3LfQkNiN2hQUOmPm7JGDfjeJDQLjfs0weW/o1nKS2 sacw== X-Gm-Message-State: AOJu0YzwUejCLD3a1HdtxxbbGL4C3TPjicNxSdZXfLmY2Y+j4in4pfuA 5/IZkwYhcArnAYuDHv71N7v76g== X-Received: by 2002:a2e:9545:0:b0:2ca:cb:36a1 with SMTP id t5-20020a2e9545000000b002ca00cb36a1mr7529025ljh.30.1702936258680; Mon, 18 Dec 2023 13:50:58 -0800 (PST) Received: from [172.30.205.119] (UNUSED.212-182-62-129.lubman.net.pl. [212.182.62.129]) by smtp.gmail.com with ESMTPSA id t1-20020a2e9c41000000b002c9ef016247sm3458166ljj.132.2023.12.18.13.50.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Dec 2023 13:50:58 -0800 (PST) Message-ID: <35e714ac-017e-4c3e-9a7f-75cf943fc515@linaro.org> Date: Mon, 18 Dec 2023 22:50:57 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 11/34] media: iris: introduce packetization layer for creating HFI packets Content-Language: en-US To: Dikshita Agarwal , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stanimir.k.varbanov@gmail.com, quic_vgarodia@quicinc.com, agross@kernel.org, andersson@kernel.org, mchehab@kernel.org, bryan.odonoghue@linaro.org Cc: linux-arm-msm@vger.kernel.org, quic_abhinavk@quicinc.com References: <1702899149-21321-1-git-send-email-quic_dikshita@quicinc.com> <1702899149-21321-12-git-send-email-quic_dikshita@quicinc.com> From: Konrad Dybcio In-Reply-To: <1702899149-21321-12-git-send-email-quic_dikshita@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/18/23 12:32, Dikshita Agarwal wrote: > Host firmware interface (HFI) is well defined set of interfaces > for communication between host driver and firmware. > The command and responses are exchanged in form of packets. > One or multiple packets are grouped under packet header. > Each packet has packet type which describes the specific HFI > and payload which holds the corresponding value for that HFI. > > Sys_init is the first packets sent to firmware, which initializes > the firmware. Sys_image_version packet is to get the firmware > version string. > > Signed-off-by: Dikshita Agarwal > --- [...] > struct iris_core { > @@ -65,6 +70,11 @@ struct iris_core { > struct mem_desc sfr; > struct mutex lock; /* lock for core structure */ > unsigned int use_tz; > + u8 *packet; > + u32 packet_size; I'm not sure it's necessary to always keep a reference to the last packet in the core struct, especially since it needs to be allocated first anyway > + u32 sys_init_id; This looks like a hyper-defensive measure against some firmware overtaking attacks.. Or a way to spot random/unwanted resets of the firmware core.. Is it actually necessary, or does this just serve as a debug feature? > + u32 header_id; Similar to above.. > + u32 packet_id; And here. I performed some quick CTRL-F-agge around the series and this is never reset.. Can the firmware cope with this? What if I watch a veeeery long youtube video that ends up creating more than (1<<32)-1 HFI packets while playing? > + > +enum hfi_packet_host_flags { > + HFI_HOST_FLAGS_NONE = 0x00000000, > + HFI_HOST_FLAGS_INTR_REQUIRED = 0x00000001, > + HFI_HOST_FLAGS_RESPONSE_REQUIRED = 0x00000002, > + HFI_HOST_FLAGS_NON_DISCARDABLE = 0x00000004, > + HFI_HOST_FLAGS_GET_PROPERTY = 0x00000008, BIT(n)? > +}; > + > +enum hfi_packet_firmware_flags { > + HFI_FW_FLAGS_NONE = 0x00000000, > + HFI_FW_FLAGS_SUCCESS = 0x00000001, > + HFI_FW_FLAGS_INFORMATION = 0x00000002, > + HFI_FW_FLAGS_SESSION_ERROR = 0x00000004, > + HFI_FW_FLAGS_SYSTEM_ERROR = 0x00000008, BIT(n)? Konrad