From nobody Fri Nov 29 23:39:52 2024 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 A5DD613AD0F for ; Fri, 13 Sep 2024 18:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252410; cv=none; b=XX+YhpsW6pdwp/QxQzqQNxRHElwBjaMrcuXksuwUj7BogRfZAc8WSJBdeHAn7xOCtessWXwOasNT7EWpdZBEH5XKr4cT3JO4LUavDkuYZh5qZb4N/uvbHDDvEOCKya1J9ysuBYlGQ9nazBS65QS/J5qIbr3vWtJbOsYk3ssQj+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252410; c=relaxed/simple; bh=KWGgAMhSiiyP8L31h701ZTjtJNsOy0WoTQfM158fupU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=F17L2u2+6t4qHB5sYBw3ZngUmUjym/ZdqjCNJdgCShaMM1FneGhysXG6elINQvXrKtu/zfmThv1qH/nsnfiz5pfdVDsoKKlBqZM6eZ2/MWigL1jybGG1dVsfgT8F4fZwzESooYa8jd5ZIEcRivbHCAZ38ZawA3OSVnjg9JZSLes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=Ilt/Ipsv; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="Ilt/Ipsv" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-45821eb62daso14261051cf.3 for ; Fri, 13 Sep 2024 11:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1726252407; x=1726857207; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2v0+dGtW112yh7kuPl9jbngDqDOI2CHxz8mSzSdgOgk=; b=Ilt/IpsvgH7nywcfAmar9EChYlPG/WaDk8pNHxHYrG8cDXcicnSGPF86dAejeTfMW5 uXt5pDCoWTs2HhQOe2Ddaqx4+ZSPknOrDawcpyHCTK/ZU+3tZpcMi/uOckGPTu+Th2oV RQ2eSBCtIw8BQNBqzEfvzETJYzoVboYgeDzuqL+hCGva1tnN0r7XLJ5f1p5H5geEXjVe 4wDSvkPnP+SWd8SzEIiQVtHmuBIk2qRq3Lpt1MYZ60lydbdIxAVaqDRqQrQ/NvWxbbSa qUPR4SqHvQPKWfBqQOsdzQvNyisQ09sREL72jJWRv6y3s5cQQzOtL7ZH4HDeX6+GXNGZ THRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726252407; x=1726857207; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2v0+dGtW112yh7kuPl9jbngDqDOI2CHxz8mSzSdgOgk=; b=KwEqb36OFwlodApT9+hpaYC+LAQFPj8P+W4P+PHUsEjKaeiHUmqESZje8aVP7unfmA /8zCvxMujTVSiW1mt0opCGiFM4vnf4TyzDdVOmNR2bT6Dg4opeZG1pZtwCVXZRe8yiVZ CYe6lhNr+3eDBH4HGG+c9Y676m3dWCabzDcnxXlsI0G4oEkx+pEGwMs2aQF4XNQv7LZ0 BPfkxVHB5ZuGQoXQ5LViKBq6sdWu8KRbeLGV/JSgk5Ej1rVAlL7WT2LLEn/0bvWV9vbX vVMlFkFmQk0SrdkrmNgUASjDAHQlQ1E9JEi+igjdRxvbi4tn9FM7NiwVY0Rtn2C9IlqN ClKA== X-Forwarded-Encrypted: i=1; AJvYcCUQ7twWz0R0WyyQgoE5DIJR9B+q2g6B+bj8mYWVZoh6+ThWE0iScLSfd6W6Q+S4zH2OkHAqicBO8Z1lCZ4=@vger.kernel.org X-Gm-Message-State: AOJu0YwQNbBA/MCkJFIHwiqsG/2vyt/+DunCy6BH1GD4ew+8mu1OeJ+a B4Mucv7zKrhofr0T2B3lbAhomGIb4DcosgdLyQYwWAHDMSP+6otU1r56d8G1Jlo= X-Google-Smtp-Source: AGHT+IGvC/54/kqTEqx6TS/kP3pJhDLE6A7PbErUo3HvjAsjov75/IPAU3sCI8+hL1thXWjQYgmYEQ== X-Received: by 2002:ac8:584d:0:b0:458:35fe:51d with SMTP id d75a77b69052e-4586045e50cmr79001221cf.60.1726252407607; Fri, 13 Sep 2024 11:33:27 -0700 (PDT) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45822f61ac7sm68596801cf.71.2024.09.13.11.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 11:33:27 -0700 (PDT) From: Gregory Price To: linux-pci@vger.kernel.org Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, dan.j.williams@intel.com, dave@stgolabs.net, jonathan.cameron@huawei.com, dave.jiang@intel.com, vishal.l.verma@intel.com Subject: [PATCH] pci/doe: add a 1 second retry window to pci_doe Date: Fri, 13 Sep 2024 14:32:41 -0400 Message-ID: <20240913183241.17320-1-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Depending on the device, sometimes firmware clears the busy flag later than expected. This can cause the device to appear busy when calling multiple commands in quick sucession. Add a 1 second retry window to all doe commands that end with -EBUSY. Signed-off-by: Gregory Price --- drivers/pci/doe.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c index 652d63df9d22..5573fa1a0008 100644 --- a/drivers/pci/doe.c +++ b/drivers/pci/doe.c @@ -647,12 +647,16 @@ int pci_doe(struct pci_doe_mb *doe_mb, u16 vendor, u8= type, .private =3D &c, }; int rc; + unsigned long timeout_jiffies =3D jiffies + (PCI_DOE_TIMEOUT * 1); =20 - rc =3D pci_doe_submit_task(doe_mb, &task); - if (rc) - return rc; + do { + rc =3D pci_doe_submit_task(doe_mb, &task); + + if (rc) + return rc; =20 - wait_for_completion(&c); + wait_for_completion(&c); + } while (task.rv =3D=3D -EBUSY && !time_after(jiffies, timeout_jiffies)); =20 return task.rv; } --=20 2.43.0