Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp16701pxj; Thu, 13 May 2021 19:29:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzzUNW7LcShFzJksB/AN59Xe9UOdjxhX9nrH6CBzSVaN87QLnsFo1u4OBH3PiSH7yy5L2Y X-Received: by 2002:aa7:c9cf:: with SMTP id i15mr53769550edt.4.1620959350385; Thu, 13 May 2021 19:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620959350; cv=none; d=google.com; s=arc-20160816; b=ASQCdP4guVyFMX50ZgHKJRym1l0muDcWEqGqjIxHOziOjqXBC8fipp+CIQpMMFGfvR WWPQWsPHOR6wiZsH5D079JO+/21IDqKkM/LBVY4N/NmBoE/rWot1KkPeu+Ve1ldHSmmD Z8Jgc9sbM5ypjB3fmEAPXv4eO9rRR+s6NJKq3kqHztht2yDLXM36L8myFqGL0cHn0lxv 67qKnCoSuV1Cj3b+mfATGrUGo+NCvzJzrS2OdO9GjI92IvTtwA6gxJE+bBYSgZ0QexWg qGNk44HBq04ffJ6zqY2A1dgpUG6m9S3zVEMrRFoWxHAboN40muipbJop/hDn3zTuoZUm Eupw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=puac9P/1pH2gTjwWoFDjpCGPhH1RSMCtsgJsRORZsps=; b=ffT/L4+tyL9btC9MgO1KHINPSxGg7TzyWy67cJA/ToeUtSEyuAHvJ4JWgExfHhugXq tCnizzPOo8f/XN4LRuICnq0bSXk0BN9PjescWcsliMczHWBQi2EJ3gozH49e35qV+a8c daE8oj7BKF1Wgk034XOn7J6reUF+FfPud89U3hiK68YphNJ9HcPXXMnzddrNLkUoc5Hi cBk5P00Q4e1EZu0Y6gd8AFq5Gw9NhZLCjXXsZNHRu86BCi1JQUy7T0UM5z3NaxFGWngG 7TeNI9/sAUITIGl5AJMHAHnrQ3ILWd5TLkP1diHtPGvMb53FIbpyd2IufTS3YNBIzgBZ UzmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uleaoi7p; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx4si4512340ejb.514.2021.05.13.19.28.46; Thu, 13 May 2021 19:29:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uleaoi7p; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231856AbhENA6o (ORCPT + 99 others); Thu, 13 May 2021 20:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231841AbhENA6k (ORCPT ); Thu, 13 May 2021 20:58:40 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E868C061574; Thu, 13 May 2021 17:57:28 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id l21so26712203iob.1; Thu, 13 May 2021 17:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=puac9P/1pH2gTjwWoFDjpCGPhH1RSMCtsgJsRORZsps=; b=uleaoi7pw6pKKSvyheVtu5WrdsRZupmmjo1QujTNyVGJQ8DgVhO7y4jFYpwCkJIhy2 68VKEMoj9rYzzCOBLGWHjXSfvisPps5OKm/Jqp9PN5IR9eHiG2WO3QCYVHXMwSzLNd9A O0uK2IdzmG6w6ZUgWg0XIor/h80j1JteyuNu5gj+cCHZ6YX9EGGAKryY0N7AcUPnQcIK vIdeab3oi0stWuXuAWdv1sQQaa2U/oM1C01bnoAVje+WPnbUZxDSwbt0jDrGDvqpwA1v tpqspuZUJ3yxTcLvPcN9YJEahK0dWjqgC/eQ8eTK/DAK7lEatlPwq4qb3xayS5RwgZXG 5QPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=puac9P/1pH2gTjwWoFDjpCGPhH1RSMCtsgJsRORZsps=; b=oKgXSuxl+E/nmVHpnbpaAAbJrCB6CUKEAZy1VuRda2PuquvlfEbNXd9FODyZtiH/R3 FlsJk9EaEbSZItCPiPSDBs2cAF7qpSl1sy8iDCRUy0bBJw+my2M8gi7hvgIAwnes4W9f e9rP+PldMOo45Aaw0qhbms/9LvWCPqkOK0gDLPHkq2EV/rkgQDYXZlF0+Yc1tIHW0e3L 1Dg67UBqi3lWg7T9DtpxgERRM5ZWSE1zCQ47zk/ouKSURJEWkzOuRYc1tDf77KIKS5BU PoSw+cRekYLRHBtw5bTNedFwXeaHK5QtbWp90lXcctQWvI3nfx5tXCpUg8jy/kVoP/wX nbqw== X-Gm-Message-State: AOAM530W2whbjTJ3jPAa81YhXDtu2kqyYf98fI1UuxDfrxsYm9LZazPC Au1KEoFbVo1RKGYGflLyXKg= X-Received: by 2002:a6b:7413:: with SMTP id s19mr32097168iog.151.1620953848097; Thu, 13 May 2021 17:57:28 -0700 (PDT) Received: from localhost.localdomain (142-79-211-230.starry-inc.net. [142.79.211.230]) by smtp.gmail.com with ESMTPSA id g25sm1981538ion.32.2021.05.13.17.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 17:57:27 -0700 (PDT) From: Connor Davis To: Greg Kroah-Hartman Cc: Connor Davis , Jann Horn , Lee Jones , Chunfeng Yun , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 1/4] usb: early: Avoid using DbC if already enabled Date: Thu, 13 May 2021 18:56:48 -0600 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check if the debug capability is enabled in early_xdbc_parse_parameter, and if it is, return with an error. This avoids collisions with whatever enabled the DbC prior to linux starting. Signed-off-by: Connor Davis --- drivers/usb/early/xhci-dbc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c index be4ecbabdd58..ca67fddc2d36 100644 --- a/drivers/usb/early/xhci-dbc.c +++ b/drivers/usb/early/xhci-dbc.c @@ -642,6 +642,16 @@ int __init early_xdbc_parse_parameter(char *s) } xdbc.xdbc_reg = (struct xdbc_regs __iomem *)(xdbc.xhci_base + offset); + if (readl(&xdbc.xdbc_reg->control) & CTRL_DBC_ENABLE) { + pr_notice("xhci debug capability already in use\n"); + early_iounmap(xdbc.xhci_base, xdbc.xhci_length); + xdbc.xdbc_reg = NULL; + xdbc.xhci_base = NULL; + xdbc.xhci_length = 0; + + return -ENODEV; + } + return 0; } -- 2.31.1