Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1699698pxb; Fri, 20 Nov 2020 17:04:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPlOExbCaO7kW0jchfk29726yX4L+Ht1YoDNZsQm27trzMxWSIZOxFulBcKOksY9y+XpSo X-Received: by 2002:a17:906:4cce:: with SMTP id q14mr14396334ejt.186.1605920677902; Fri, 20 Nov 2020 17:04:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605920677; cv=none; d=google.com; s=arc-20160816; b=nmMOk2aeS/1mJw0vhOGU7uvUiBGxlukeGS2x/n+R9L/aI40Vo/KRg/fzzmayIVjeYD p1ZSffIA2TzoLbBlLZryuuCP+ClrE6HeEWR6eBlN7NU5A0LL83W/Mey/W0wyd/5h1axl cakuxb5fJGjUG2gba9DUpLzILH32zz8HzVQtmoKuayyu9qdVl+QwrnQTbgs6ysMUtSkV WArcMiv527hG4Cavk3c3qJowLYhOTCoK8ub3cpkfkuRltkWpaK/MOQTuwwa+H0ojqlw8 AKrtdt73aWG/SxErJgDi03QuP4Wl2M4XaMGZuuz9RLottgGAz8B6qwyiezJWDxTw3Scf Nvzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sk9JMkU18BJoY1tiLV8iF0/kiIHyna9O/RVdUCBqU8U=; b=C2SfEIMtE47vh0M6HMgj+oI9Iyk+GGVe+db8BiMu16lTnon1AfgcaBSFMihU6f9isq sQYgdX9rBvp+PDcMEJ8KVx/VoaDasv4a58zELqJO8hy72FPUEA+e8X3ONe4q1UYg4rN+ oFhpqUQRqTVUB1PyN3BSx1owwrTZzfr6yG0xiPwGhqCDawVMy85q18WVB9yImvYfLGnd xKK3/dzaTUjC5CNVCIyhZC9+I/V/fgNKlKFyNj5pJQDzwHl84wisJknF8gsVkpnKYeoZ X4b5zyTAz33U8kC+EKOvideR9W4vpkebMMNy7sfaEQ8jFAtVemboCvBTmPH4+ti5mA/A RGFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V7bNk2SP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr31si2570441ejc.233.2020.11.20.17.04.15; Fri, 20 Nov 2020 17:04:37 -0800 (PST) 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=@chromium.org header.s=google header.b=V7bNk2SP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728462AbgKUBC7 (ORCPT + 99 others); Fri, 20 Nov 2020 20:02:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbgKUBC6 (ORCPT ); Fri, 20 Nov 2020 20:02:58 -0500 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B54AC061A04 for ; Fri, 20 Nov 2020 17:02:58 -0800 (PST) Received: by mail-ej1-x642.google.com with SMTP id a16so15384901ejj.5 for ; Fri, 20 Nov 2020 17:02:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sk9JMkU18BJoY1tiLV8iF0/kiIHyna9O/RVdUCBqU8U=; b=V7bNk2SPrdN/SRh+iXN6Ri1rwBZAuSGh6TyIHNJrk8vH48eXGgEMm/YmZKcooovROC ftcGKO1vRdN7AHK2Lt/wF0U7LnT0XCt6Fx+Af/IpPON15v5KGiS2PhIeulTZWrNrUYz8 7DKCJv8vzsUXsmcXTHBs86CtnrAt+kOsMSzn4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sk9JMkU18BJoY1tiLV8iF0/kiIHyna9O/RVdUCBqU8U=; b=nHinpVmj3gij5i0gC9ISNQe79qIAF59RX4q3QFf/xTLMMwcXT0tZ6VcSN/UCni9v9W gJXtvT11+GmlMY5eQ0NeeV3rV5lgCE0Bh7KQah6oo2w05UyspPR2VXzUIrfAI9/qTld5 avOqH8/nLUWZpyXPx4UoDvtjuzDWUsFlPgaF8zAIPN1TGnnYGMgKxYw/5yzI2jjtUxXm csYGN75e0/a3YwMmAHopKF2n1gTAJlaCK9xO1sgqi02m3aBLQflQ4/nBhXjlUTrF/HZq LKBfzPmKgJ/dIIfzOQrmteb5RRmJN6yCJ5Ws6EwzkT0LTurrC+hSY9M1FRpRjHq1ZAGk On3w== X-Gm-Message-State: AOAM532tObkuui0oifoKRnJvwhY9aEHhN6lKgIycMj4hFwuPovj+0PWk 5NuYO3dL3JNnYMXHFpr99Ft4Sw//jAy2kw== X-Received: by 2002:a17:907:b02:: with SMTP id h2mr7999985ejl.128.1605920576429; Fri, 20 Nov 2020 17:02:56 -0800 (PST) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com. [209.85.128.46]) by smtp.gmail.com with ESMTPSA id d20sm1745474eja.4.2020.11.20.17.02.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Nov 2020 17:02:55 -0800 (PST) Received: by mail-wm1-f46.google.com with SMTP id x13so3960591wmj.1 for ; Fri, 20 Nov 2020 17:02:55 -0800 (PST) X-Received: by 2002:a1c:31c6:: with SMTP id x189mr1524416wmx.50.1605920575058; Fri, 20 Nov 2020 17:02:55 -0800 (PST) MIME-Version: 1.0 References: <20201120001037.10032-1-stanimir.varbanov@linaro.org> <20201120001037.10032-4-stanimir.varbanov@linaro.org> In-Reply-To: <20201120001037.10032-4-stanimir.varbanov@linaro.org> From: Fritz Koenig Date: Fri, 20 Nov 2020 17:02:42 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] media: hfi_venus: Request interrupt for sync cmds To: Stanimir Varbanov Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Vikash Garodia , Mansur Alisha Shaik , Dikshita Agarwal Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 19, 2020 at 4:12 PM Stanimir Varbanov wrote: > > From: Vikash Garodia > > For synchronous commands, update the message queue variable. > This would inform video firmware to raise interrupt on host > CPU whenever there is a response for such commands. > > Signed-off-by: Vikash Garodia > Signed-off-by: Stanimir Varbanov > --- > drivers/media/platform/qcom/venus/hfi_venus.c | 74 ++++++++++--------- > 1 file changed, 41 insertions(+), 33 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c > index 4be4a75ddcb6..b8fdb464ba9c 100644 > --- a/drivers/media/platform/qcom/venus/hfi_venus.c > +++ b/drivers/media/platform/qcom/venus/hfi_venus.c > @@ -372,7 +372,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev) > } > > static int venus_iface_cmdq_write_nolock(struct venus_hfi_device *hdev, > - void *pkt) > + void *pkt, bool sync) > { > struct device *dev = hdev->core->dev; > struct hfi_pkt_hdr *cmd_packet; > @@ -397,15 +397,23 @@ static int venus_iface_cmdq_write_nolock(struct venus_hfi_device *hdev, > if (rx_req) > venus_soft_int(hdev); > > + /* Inform video firmware to raise interrupt for synchronous commands */ > + queue = &hdev->queues[IFACEQ_MSG_IDX]; I don't think there is any reason to scope queue outside of the sync block below. > > + if (sync) { > + queue->qhdr->rx_req = 1; > + /* ensure rx_req is updated in memory */ > + wmb(); > + } > + > return 0; > } > > -static int venus_iface_cmdq_write(struct venus_hfi_device *hdev, void *pkt) > +static int venus_iface_cmdq_write(struct venus_hfi_device *hdev, void *pkt, bool sync) > { > int ret; > > mutex_lock(&hdev->lock); > - ret = venus_iface_cmdq_write_nolock(hdev, pkt); > + ret = venus_iface_cmdq_write_nolock(hdev, pkt, sync); > mutex_unlock(&hdev->lock); > > return ret; > @@ -428,7 +436,7 @@ static int venus_hfi_core_set_resource(struct venus_core *core, u32 id, > if (ret) > return ret; > > - ret = venus_iface_cmdq_write(hdev, pkt); > + ret = venus_iface_cmdq_write(hdev, pkt, false); > if (ret) > return ret; > > @@ -778,7 +786,7 @@ static int venus_sys_set_debug(struct venus_hfi_device *hdev, u32 debug) > > pkt_sys_debug_config(pkt, HFI_DEBUG_MODE_QUEUE, debug); > > - ret = venus_iface_cmdq_write(hdev, pkt); > + ret = venus_iface_cmdq_write(hdev, pkt, false); > if (ret) > return ret; > > @@ -795,7 +803,7 @@ static int venus_sys_set_coverage(struct venus_hfi_device *hdev, u32 mode) > > pkt_sys_coverage_config(pkt, mode); > > - ret = venus_iface_cmdq_write(hdev, pkt); > + ret = venus_iface_cmdq_write(hdev, pkt, false); > if (ret) > return ret; > > @@ -816,7 +824,7 @@ static int venus_sys_set_idle_message(struct venus_hfi_device *hdev, > > pkt_sys_idle_indicator(pkt, enable); > > - ret = venus_iface_cmdq_write(hdev, pkt); > + ret = venus_iface_cmdq_write(hdev, pkt, false); > if (ret) > return ret; > > @@ -834,7 +842,7 @@ static int venus_sys_set_power_control(struct venus_hfi_device *hdev, > > pkt_sys_power_control(pkt, enable); > > - ret = venus_iface_cmdq_write(hdev, pkt); > + ret = venus_iface_cmdq_write(hdev, pkt, false); > if (ret) > return ret; > > @@ -885,14 +893,14 @@ static int venus_sys_set_default_properties(struct venus_hfi_device *hdev) > return ret; > } > > -static int venus_session_cmd(struct venus_inst *inst, u32 pkt_type) > +static int venus_session_cmd(struct venus_inst *inst, u32 pkt_type, bool sync) > { > struct venus_hfi_device *hdev = to_hfi_priv(inst->core); > struct hfi_session_pkt pkt; > > pkt_session_cmd(&pkt, pkt_type, inst); > > - return venus_iface_cmdq_write(hdev, &pkt); > + return venus_iface_cmdq_write(hdev, &pkt, sync); > } > > static void venus_flush_debug_queue(struct venus_hfi_device *hdev) > @@ -922,7 +930,7 @@ static int venus_prepare_power_collapse(struct venus_hfi_device *hdev, > > pkt_sys_pc_prep(&pkt); > > - ret = venus_iface_cmdq_write(hdev, &pkt); > + ret = venus_iface_cmdq_write(hdev, &pkt, false); > if (ret) > return ret; > > @@ -1064,13 +1072,13 @@ static int venus_core_init(struct venus_core *core) > > venus_set_state(hdev, VENUS_STATE_INIT); > > - ret = venus_iface_cmdq_write(hdev, &pkt); > + ret = venus_iface_cmdq_write(hdev, &pkt, false); > if (ret) > return ret; > > pkt_sys_image_version(&version_pkt); > > - ret = venus_iface_cmdq_write(hdev, &version_pkt); > + ret = venus_iface_cmdq_write(hdev, &version_pkt, false); > if (ret) > dev_warn(dev, "failed to send image version pkt to fw\n"); > > @@ -1099,7 +1107,7 @@ static int venus_core_ping(struct venus_core *core, u32 cookie) > > pkt_sys_ping(&pkt, cookie); > > - return venus_iface_cmdq_write(hdev, &pkt); > + return venus_iface_cmdq_write(hdev, &pkt, false); > } > > static int venus_core_trigger_ssr(struct venus_core *core, u32 trigger_type) > @@ -1112,7 +1120,7 @@ static int venus_core_trigger_ssr(struct venus_core *core, u32 trigger_type) > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, &pkt); > + return venus_iface_cmdq_write(hdev, &pkt, false); > } > > static int venus_session_init(struct venus_inst *inst, u32 session_type, > @@ -1130,7 +1138,7 @@ static int venus_session_init(struct venus_inst *inst, u32 session_type, > if (ret) > goto err; > > - ret = venus_iface_cmdq_write(hdev, &pkt); > + ret = venus_iface_cmdq_write(hdev, &pkt, true); > if (ret) > goto err; > > @@ -1151,7 +1159,7 @@ static int venus_session_end(struct venus_inst *inst) > dev_warn(dev, "fw coverage msg ON failed\n"); > } > > - return venus_session_cmd(inst, HFI_CMD_SYS_SESSION_END); > + return venus_session_cmd(inst, HFI_CMD_SYS_SESSION_END, true); > } > > static int venus_session_abort(struct venus_inst *inst) > @@ -1160,7 +1168,7 @@ static int venus_session_abort(struct venus_inst *inst) > > venus_flush_debug_queue(hdev); > > - return venus_session_cmd(inst, HFI_CMD_SYS_SESSION_ABORT); > + return venus_session_cmd(inst, HFI_CMD_SYS_SESSION_ABORT, true); > } > > static int venus_session_flush(struct venus_inst *inst, u32 flush_mode) > @@ -1173,22 +1181,22 @@ static int venus_session_flush(struct venus_inst *inst, u32 flush_mode) > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, &pkt); > + return venus_iface_cmdq_write(hdev, &pkt, true); > } > > static int venus_session_start(struct venus_inst *inst) > { > - return venus_session_cmd(inst, HFI_CMD_SESSION_START); > + return venus_session_cmd(inst, HFI_CMD_SESSION_START, true); > } > > static int venus_session_stop(struct venus_inst *inst) > { > - return venus_session_cmd(inst, HFI_CMD_SESSION_STOP); > + return venus_session_cmd(inst, HFI_CMD_SESSION_STOP, true); > } > > static int venus_session_continue(struct venus_inst *inst) > { > - return venus_session_cmd(inst, HFI_CMD_SESSION_CONTINUE); > + return venus_session_cmd(inst, HFI_CMD_SESSION_CONTINUE, false); > } > > static int venus_session_etb(struct venus_inst *inst, > @@ -1205,7 +1213,7 @@ static int venus_session_etb(struct venus_inst *inst, > if (ret) > return ret; > > - ret = venus_iface_cmdq_write(hdev, &pkt); > + ret = venus_iface_cmdq_write(hdev, &pkt, false); > } else if (session_type == VIDC_SESSION_TYPE_ENC) { > struct hfi_session_empty_buffer_uncompressed_plane0_pkt pkt; > > @@ -1213,7 +1221,7 @@ static int venus_session_etb(struct venus_inst *inst, > if (ret) > return ret; > > - ret = venus_iface_cmdq_write(hdev, &pkt); > + ret = venus_iface_cmdq_write(hdev, &pkt, false); > } else { > ret = -EINVAL; > } > @@ -1232,7 +1240,7 @@ static int venus_session_ftb(struct venus_inst *inst, > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, &pkt); > + return venus_iface_cmdq_write(hdev, &pkt, false); > } > > static int venus_session_set_buffers(struct venus_inst *inst, > @@ -1252,7 +1260,7 @@ static int venus_session_set_buffers(struct venus_inst *inst, > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, pkt); > + return venus_iface_cmdq_write(hdev, pkt, false); > } > > static int venus_session_unset_buffers(struct venus_inst *inst, > @@ -1272,17 +1280,17 @@ static int venus_session_unset_buffers(struct venus_inst *inst, > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, pkt); > + return venus_iface_cmdq_write(hdev, pkt, true); > } > > static int venus_session_load_res(struct venus_inst *inst) > { > - return venus_session_cmd(inst, HFI_CMD_SESSION_LOAD_RESOURCES); > + return venus_session_cmd(inst, HFI_CMD_SESSION_LOAD_RESOURCES, true); > } > > static int venus_session_release_res(struct venus_inst *inst) > { > - return venus_session_cmd(inst, HFI_CMD_SESSION_RELEASE_RESOURCES); > + return venus_session_cmd(inst, HFI_CMD_SESSION_RELEASE_RESOURCES, true); > } > > static int venus_session_parse_seq_hdr(struct venus_inst *inst, u32 seq_hdr, > @@ -1299,7 +1307,7 @@ static int venus_session_parse_seq_hdr(struct venus_inst *inst, u32 seq_hdr, > if (ret) > return ret; > > - ret = venus_iface_cmdq_write(hdev, pkt); > + ret = venus_iface_cmdq_write(hdev, pkt, false); > if (ret) > return ret; > > @@ -1320,7 +1328,7 @@ static int venus_session_get_seq_hdr(struct venus_inst *inst, u32 seq_hdr, > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, pkt); > + return venus_iface_cmdq_write(hdev, pkt, false); > } > > static int venus_session_set_property(struct venus_inst *inst, u32 ptype, > @@ -1339,7 +1347,7 @@ static int venus_session_set_property(struct venus_inst *inst, u32 ptype, > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, pkt); > + return venus_iface_cmdq_write(hdev, pkt, false); > } > > static int venus_session_get_property(struct venus_inst *inst, u32 ptype) > @@ -1352,7 +1360,7 @@ static int venus_session_get_property(struct venus_inst *inst, u32 ptype) > if (ret) > return ret; > > - return venus_iface_cmdq_write(hdev, &pkt); > + return venus_iface_cmdq_write(hdev, &pkt, true); > } > > static int venus_resume(struct venus_core *core) > -- > 2.17.1 >