From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 71DBA35F189 for ; Fri, 27 Mar 2026 19:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774641523; cv=none; b=ZZZy/dEci//6+mYYIFDyDx2CVfUNcahpIt0dceL/jJxlvG7MOqkbicn3LKPXbaX5e3kf5Qnip8str/zX4Yu9M//BM2okgY0tY5TNJys+qcooVzlnD/0HtXnRhEzVL4SsTtVtRtGl+azVVzdRtj/b6bLv01xDlwZajsLXnjSOAI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774641523; c=relaxed/simple; bh=0evNptiIp2i5VFaMPmgvkXbxXGx4HuiZJh41Ylbun7k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nMBSTNrkeWJxe47srRQ1FWToP2GPdeqFHb7t5268lugMRI1E0dJAWIwIYvbGub+0GT+gupZ74XXKO/+/c6SHNBislFmnjg8izw+QHPueBwXCp73melWC5GYq7OnWLQI9EbsC9LpvYxDh0eBYrtRt4K5uDtZy1CjEu59Kh1qEflY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SHnxVr6D; arc=none smtp.client-ip=209.85.214.180 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SHnxVr6D" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2a7a9b8ed69so24677085ad.2 for ; Fri, 27 Mar 2026 12:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1774641522; x=1775246322; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=riqFgloemKeGp2Z33+taeOI5x5WX9rolIEiX3Srhmn8=; b=SHnxVr6Dw+kXmVpQOpEcyv5M7q4Gy78VtRHCtIJa+kJDths0ToU0FXWkjK23MA3FPH /iWUW8M7xoU34ZPyzCsyT0O4AYJBLr/ZeYdvEBcJvNH8TizwnvlSWBcMfcebNjVJHCEb 7KJODkSsW+kPRY6qb9Hlx8WqY65I98R6x3aiT2aH15j39u292f8+TuPgFst2ejecMnEV FEsUYENA6szSAEigKBPzBK+Nc2pZ3a/sZ2Je89BfEP61VMHN2IWAWSyUEJZxrb2jpKj+ e2qXXzoGb5Wycc5rAgnUO1/Yha4KAkaYt+2SMkWU5t//E9hmlBQLFwZwN/Pgjr6vXQHJ YOEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774641522; x=1775246322; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=riqFgloemKeGp2Z33+taeOI5x5WX9rolIEiX3Srhmn8=; b=lOlBaWA2ClMiB1UAzMdyz+ERj1ElI2Qlxe1H6YEKm42SGXEYKNVa0EsbpAvU+cZ/2o DCyNsy2Dxyo1HMDiSEzBQgV0YfXW3yTxygLpb0xNC0xKRsEDHnk2awvcBuyVlH87U2va ygh/Plo9LnFc/bwa6nqfZRP+TJMqtaZXc/TPBIuLzofIgkPcxa/v0zCscdkSIGwCk/bP C+orskxdxvM3wHXi+9TLGwlqtOIxW39F33QXiAXaZEG74NjKxMhE++r332oMANnw5D7c zQ9q8WSvaizNvonRRea08xapeU+kwJ0CuE1bjbZpqspNEhirhAkr4WLC5+KJn7FXAEH8 zO4w== X-Forwarded-Encrypted: i=1; AJvYcCXfTP5nyF/Zp/k7vYw97u3hScuxU46tCmD3xE2Z56cMh7/R70oSEWNjrvfJ9ZwL8AW+TBFWeei073vYtyA=@vger.kernel.org X-Gm-Message-State: AOJu0Yyz12AerwyOIvzxq6nc3CT1DTg6z2P60Bzs2oxN9ODCDeT7XJ99 dwDCJYyCujTrOblvlF9HvJZALLlJ5dvqW/xFfhcvCHhjFFMhvQdyagk5+Kmq/H5et5VyNwf4YXM Sb2V8 X-Gm-Gg: ATEYQzzR//pZNsu/a/IRm2xmw5fLwMITNfWGeZEXM/+kmBZ8meB1nmCqPXz3LQ7iEJf FJBTQGRdfLcMjZGNJxWmKKF1a93TsA6L4mYDAr+8rLZPd9R2dETwu1d2cm9DKHdWhcoBnVPsS4L IPRNlBhK+DHzON2ZiuQ8P27AYetZ4/t2unktMZsX8kaBi7c+S0w9nBeIzE19/I82dS03+ld2ith O8hXVvmvshwjHTrsbKfcMnZ4kxe5IsPRo08AAsMtbeGeZZDVfNa8LImAXzTT1/BcoMnvqnwvhtI cVj9HPpw8xTgU/sohl9jy6pbr4g07qZrOlzD2fOGVakYrp3tg48/3VTKzhdctuSrB3n5cy716oJ 0bnm/xEO850oj7egunDtIBE973VpJDyVIOK3SKago5M7z9ZRo3usW/CjoVwjdQupcJ7wAJ37FPo 51GXvxqTYx/r9Q1OkU3eIFaOoZkRs= X-Received: by 2002:a17:902:f681:b0:2b0:b2b4:1444 with SMTP id d9443c01a7336-2b0cdd13eaamr39512765ad.49.1774641521670; Fri, 27 Mar 2026 12:58:41 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:2f18:b190:e634:5792]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b24264256asm1248025ad.13.2026.03.27.12.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2026 12:58:41 -0700 (PDT) Date: Fri, 27 Mar 2026 13:58:38 -0600 From: Mathieu Poirier To: Tanmay Shah Cc: andersson@kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] remoteproc: xlnx: reset virtio status during attach Message-ID: References: <20260317201251.3920841-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260317201251.3920841-1-tanmay.shah@amd.com> On Tue, Mar 17, 2026 at 01:12:51PM -0700, Tanmay Shah wrote: > On AMD-Xilinx platforms cortex-A and cortex-R can be configured as > separate subsystems. In this case, both cores can boot independent of > each other. If Linux went through uncontrolled reboot during active > rpmsg communication, then during next boot it can find rpmsg virtio > status not in the reset state. In such case it is important to reset the > virtio status during attach callback and wait for sometime for the > remote to handle virtio driver reset. I understand the user case, but won't that situation happen regardless of whether cores operate sync or split mode? > > Signed-off-by: Tanmay Shah > --- > drivers/remoteproc/xlnx_r5_remoteproc.c | 46 +++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c > index 50a9974f3202..f08806f13800 100644 > --- a/drivers/remoteproc/xlnx_r5_remoteproc.c > +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c > @@ -5,6 +5,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -29,6 +30,8 @@ > #define RSC_TBL_XLNX_MAGIC ((uint32_t)'x' << 24 | (uint32_t)'a' << 16 | \ > (uint32_t)'m' << 8 | (uint32_t)'p') > > +#define RPROC_ATTACH_TIMEOUT_US (100 * 1000) > + There are some time constant already defined, please use them. > /* > * settings for RPU cluster mode which > * reflects possible values of xlnx,cluster-mode dt-property > @@ -865,6 +868,49 @@ static int zynqmp_r5_get_rsc_table_va(struct zynqmp_r5_core *r5_core) > > static int zynqmp_r5_attach(struct rproc *rproc) > { > + struct device *dev = &rproc->dev; > + bool wait_for_remote = false; > + struct fw_rsc_vdev *rsc; > + struct fw_rsc_hdr *hdr; > + int i, offset, avail; > + > + if (!rproc->table_ptr) > + goto attach_success; > + > + for (i = 0; i < rproc->table_ptr->num; i++) { > + offset = rproc->table_ptr->offset[i]; > + hdr = (void *)rproc->table_ptr + offset; > + avail = rproc->table_sz - offset - sizeof(*hdr); > + rsc = (void *)hdr + sizeof(*hdr); > + > + /* make sure table isn't truncated */ > + if (avail < 0) { > + dev_err(dev, "rsc table is truncated\n"); > + return -EINVAL; > + } > + > + if (hdr->type != RSC_VDEV) > + continue; > + > + /* > + * reset vdev status, in case previous run didn't leave it in > + * a clean state. > + */ > + if (rsc->status) { > + rsc->status = 0; > + wait_for_remote = true; > + break; > + } > + } > + > + /* kick remote to notify about attach */ > + rproc->ops->kick(rproc, 0); > + > + /* wait for sometime until remote is ready */ > + if (wait_for_remote) > + usleep_range(100, RPROC_ATTACH_TIMEOUT_US); Instead of waiting, would it be possible to return -EPROBE_DEFER and let the driver core retry mechanic do it's work? Thanks, Mathieu > + > +attach_success: > dev_dbg(&rproc->dev, "rproc %d attached\n", rproc->index); > > return 0; > > base-commit: d4ef36fbd57e610d4c334123ce706a2a71187cae > -- > 2.34.1 >