Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4268833pxv; Mon, 19 Jul 2021 22:40:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9+9Mx7zwFDqz2ddWLtJ3Plne46Ik0UZ6XQHaXmJvqyKJ03y1+LuEzY9BADuGic5glEIgH X-Received: by 2002:a05:6638:1356:: with SMTP id u22mr25246291jad.39.1626759600979; Mon, 19 Jul 2021 22:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626759600; cv=none; d=google.com; s=arc-20160816; b=nRnlZytFSzNT2t3pyg/hmegCVrXSiNDrwUz6DpklDBhTT7gusyt10R3whnBY9OTeM2 K5/xRkHj+IYQlDBTgWk3t/eaSFWD1l2+141HppCpP5RBbuEABeSyZ5vFJ0Nl3RLyTWkl 8I8k6mjgm3xLH7HZXOXXSLTd5x9MTf78bMT9nQab1rk5leod+1mzxznXOlCX98oVNcdf vyaM69q8jlU0jbxBToy3x4wzXjsjftmer4qqfsegnsW23cMS3gUMyM8IYcfVKp9N78kN WAJBo4rk31gBYUaZ/YrcX/9SP78XoHA6LCGtV7f1blM0Cpp/NudOnlX/HcbTEOEX0wVr MTAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=H6FMY36ifoVcSW+eRrx8urOcqQvcESIiNUaCo0mYNkk=; b=fPsQKObAerlR6AGZj3wgh6opT3xdKWrrW1qpa5VvToRpRb1JWoNrFSpNDX0BB/ygpx 9zvLDdA6ZkCqRyWwN7b53W1Yu67NQJurq4BuaTPQ1hj1NAv3tnNeHoFN+kymViVvQmW3 kYovwDWy6iuimpgKFpg5rNpKxR6VOOokiJ10TXaD9xWZTW+h5FSVHrk/UVfQXkDNhhqE R/9kFjqDzQ5f13/wGd9xCJglfwkjDteR/gG1mgtEp0V2VbVWiBm1jE3ubo+Wv5WwL/wC ygpQS37tSYrbz0cR0TvYYw0otYqadr1b/JS21gyue+qwaNjQ7eyuD2FO65byRL797q38 6/HA== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z25si11396184iod.45.2021.07.19.22.39.49; Mon, 19 Jul 2021 22:40:00 -0700 (PDT) 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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238207AbhGTE6G (ORCPT + 99 others); Tue, 20 Jul 2021 00:58:06 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:44773 "EHLO mail-pj1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237648AbhGTE6D (ORCPT ); Tue, 20 Jul 2021 00:58:03 -0400 Received: by mail-pj1-f41.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so1816275pjo.3; Mon, 19 Jul 2021 22:38:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=H6FMY36ifoVcSW+eRrx8urOcqQvcESIiNUaCo0mYNkk=; b=rgAJmyzEzCvy4zhFESu3jOuAc3d6SMFB0kJnSvNpgG1QV6jacx/9WlePrBh2berJcC EPyvXEWG+rbXGlsSmi7CvsaS5RbALvgVQEWfacbvdgWwwZGqIIP9SIdr+fhIL5OTOBCi fhbbBkWAhNlAKRt+bAVwU0fcLbQKLeStQ3k/SoJ94LGe6S9Xk2QHwYPHPQEX8xbdvXf7 iTG0MRbHro2uk5x+3VZSw6IrCoVdLLUlhqG29aKt7N+HHzB4ewagVtqP3/vr/+f0PlCJ RnuMX7WE65HP9BJraDWQnznFtp/D4k59X7BO1uBOideEUCVW5t26n5JrmLTjPZxh8/xz uX7w== X-Gm-Message-State: AOAM531gn1Fujbct7iumTJEgUrZpW19fzbF257vWA91JIV+gpdn/Khdl wH4mM8SYEq7waQnmryC7DIc= X-Received: by 2002:a17:902:684a:b029:12b:8d3e:68dc with SMTP id f10-20020a170902684ab029012b8d3e68dcmr6177240pln.79.1626759521913; Mon, 19 Jul 2021 22:38:41 -0700 (PDT) Received: from localhost ([2601:647:5b00:6f70:be34:681b:b1e9:776f]) by smtp.gmail.com with ESMTPSA id b9sm20591709pfm.124.2021.07.19.22.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 22:38:41 -0700 (PDT) Date: Mon, 19 Jul 2021 22:38:40 -0700 From: Moritz Fischer To: Justin Forbes Cc: Moritz Fischer , Greg Kroah-Hartman , LKML , Stable , Mathias Nyman , Vinod Koul Subject: Re: [PATCH 5.13 024/800] usb: renesas-xhci: Fix handling of unknown ROM state Message-ID: References: <20210712060912.995381202@linuxfoundation.org> <20210712060916.499546891@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 19, 2021 at 09:57:00PM -0500, Justin Forbes wrote: > On Mon, Jul 19, 2021 at 10:33 AM Justin Forbes wrote: > > > > On Sat, Jul 17, 2021 at 5:33 PM Moritz Fischer wrote: > > > > > > Justin, > > > > > > On Sat, Jul 17, 2021 at 08:39:19AM -0500, Justin Forbes wrote: > > > > On Mon, Jul 12, 2021 at 2:31 AM Greg Kroah-Hartman > > > > wrote: > > > > > > > > > > From: Moritz Fischer > > > > > > > > > > commit d143825baf15f204dac60acdf95e428182aa3374 upstream. > > > > > > > > > > The ROM load sometimes seems to return an unknown status > > > > > (RENESAS_ROM_STATUS_NO_RESULT) instead of success / fail. > > > > > > > > > > If the ROM load indeed failed this leads to failures when trying to > > > > > communicate with the controller later on. > > > > > > > > > > Attempt to load firmware using RAM load in those cases. > > > > > > > > > > Fixes: 2478be82de44 ("usb: renesas-xhci: Add ROM loader for uPD720201") > > > > > Cc: stable@vger.kernel.org > > > > > Cc: Mathias Nyman > > > > > Cc: Greg Kroah-Hartman > > > > > Cc: Vinod Koul > > > > > Tested-by: Vinod Koul > > > > > Reviewed-by: Vinod Koul > > > > > Signed-off-by: Moritz Fischer > > > > > Link: https://lore.kernel.org/r/20210615153758.253572-1-mdf@kernel.org > > > > > Signed-off-by: Greg Kroah-Hartman > > > > > > > > > > > > > After sending out 5.12.17 for testing, we had a user complain that all > > > > of their USB devices disappeared with the error: > > > > > > > > Jul 15 23:18:53 kernel: xhci_hcd 0000:04:00.0: Direct firmware load > > > > for renesas_usb_fw.mem failed with error -2 > > > > Jul 15 23:18:53 kernel: xhci_hcd 0000:04:00.0: request_firmware failed: -2 > > > > Jul 15 23:18:53 kernel: xhci_hcd: probe of 0000:04:00.0 failed with error -2 > > > > > > This looks like it fails finding the actual firmware file (ENOENT). Any > > > chance you could give this a whirl on top of the original patch? > > > > > > > Sure. test kernel building now, will let you know when the user reports back. > > The original user reports success with this patch on top of the original patch. That's good news I guess. After reading through the datasheet once more I'm even more convinced that the original code with the early return in renesas_check_fw_running() is *very* shady. There are three statuses to be investigated - FW load status (fw_state) - ROM download status (rom_status) - Firmware version as reported by chip Currently there the code takes an early return if the latter says the external ROM is there and the 'write firmware to external ROM' worked out, which I think shouldn't be happening, since it doesn't tell us anything about the firmware state at all. In fact I think the early return should not exist at all (a path that the original patch made more likely to happen). The FW load status indicates whether firmware has been runtime loaded and returns 'No result yet' in your case, too I suspect, which *might* happen if the chip configured itself from external ROM? So the part that is unclear to me somewhat is should we use either of them at all in trying to determine whether we should load firmware? Maybe what we should do is: - Attempt to request_firmware() - If fail -> proceed and hope for the best - If success - Compare the firmware file version with the version reported by the controller - If they don't match, load firmware, otherwise leave it alone? - Moritz > > Justin > > > > > Justin > > > > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c > > > index 18c2bbddf080..cde8f6f1ec5d 100644 > > > --- a/drivers/usb/host/xhci-pci.c > > > +++ b/drivers/usb/host/xhci-pci.c > > > @@ -379,7 +379,11 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) > > > driver_data = (struct xhci_driver_data *)id->driver_data; > > > if (driver_data && driver_data->quirks & XHCI_RENESAS_FW_QUIRK) { > > > retval = renesas_xhci_check_request_fw(dev, id); > > > - if (retval) > > > + /* > > > + * If firmware wasn't found there's still a chance this might work without > > > + * loading firmware on some systems, so let's try at least. > > > + */ > > > + if (retval && retval != -ENOENT) > > > return retval; > > > } > > > > > > > > > Thanks, > > > Moritz