From nobody Fri Nov 29 22:57:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1620778729; cv=none; d=zohomail.com; s=zohoarc; b=Ba6avLyaXl5PpqQyP5KyWwFk9cOwNd1OBkJ8J9h0Vc5z/iatxKvfJr5mZVIAtOOb3k0as+nYVfdf8wJ5vvkAQbIjjxVrX7bSxBU3obdfNJ0JpHDXFLrj9zZGYD17utcqzpScoAyqO7IK0b6VyUreKW88gI6s5CfURW+YF0BAgNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620778729; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=puac9P/1pH2gTjwWoFDjpCGPhH1RSMCtsgJsRORZsps=; b=e3nNX9sVL2SGIdkb1fU+B3xN3r/RhaJVtmZCJMWYdlyre7h9AkRR3cX+v8W5Zle225Ye2eAp/NNyYYgKfaPwCq3NUvpVrFDxWo+9g01iuL+DtXAPVuZwPqsqJqiguoZcv57rwKv/iqn8g9psxPRwS4lhrBN9MQ5n07hkG2+eH8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 162077872951580.48902376820229; Tue, 11 May 2021 17:18:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.126088.237355 (Exim 4.92) (envelope-from ) id 1lgca6-00013G-7c; Wed, 12 May 2021 00:18:30 +0000 Received: by outflank-mailman (output) from mailman id 126088.237355; Wed, 12 May 2021 00:18:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgca6-000139-42; Wed, 12 May 2021 00:18:30 +0000 Received: by outflank-mailman (input) for mailman id 126088; Wed, 12 May 2021 00:18:28 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgca4-0000kd-C8 for xen-devel@lists.xenproject.org; Wed, 12 May 2021 00:18:28 +0000 Received: from mail-il1-x133.google.com (unknown [2607:f8b0:4864:20::133]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5e7ffde7-960e-4ccf-ba48-8aeda0aaa6ca; Wed, 12 May 2021 00:18:27 +0000 (UTC) Received: by mail-il1-x133.google.com with SMTP id z1so10881633ils.0 for ; Tue, 11 May 2021 17:18:27 -0700 (PDT) Received: from localhost.localdomain (142-79-211-230.starry-inc.net. [142.79.211.230]) by smtp.gmail.com with ESMTPSA id v4sm8241490iol.3.2021.05.11.17.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 17:18:27 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5e7ffde7-960e-4ccf-ba48-8aeda0aaa6ca 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=KVnhpxSKSgjxFKZXFSiHszto+jk1TG6dHF6KfPOJDxdnW5ABx+HpY3LPhsV0oNEYdU oOY2KZnnEdfwyeoTn19rO/DWpWf0O3blIvpZ0JPdzTmItMYHWDFp4hP9TX8JFPXxs8t6 OEOQhUyyUCvwrEwL+kXIgkSEVJBz+mIgiLVe1X9ca0uYQWF5H9EbzFZ77PHOPnKfdS2Z V76FL/tX9xIwhDf+ym/LTIwmGVj2VeuWwJyy+uEOBU9ZlksbvAQo4MmOawNclyzLEnpa IjYwCl2dc5uthpQGF5HR1mj1jfG5xvg1/BdoGsFLLYXQzg9LYFdfSxy7fb2uZpVBkOG4 jyRw== 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=CTxA60GRD+3ZVIgO6cAc809/V0mnUqiqUfacE1BYLVqxD36DeKF3tSAZQ2A0aRSfks j60H0A69IkC6k2Zyeo1jM7rmyHpB//spmOfV9moIiTYc8KHQdMYRYShX/6rMJZncr6rN bW7csdExThQ7UzBsD0XtnUrfkLbnmZHOR7p7P0VJCVHtM7Ur/su1jyPAb06N5/9CulTf /osvFTQBWH+hlBDGfR3CW3v82+URdc2Iihuq8J4wz7LlNhTP/vokqH9G0ee7I6Ixp9VQ QJby1vd6iJK9V9XzNT0sJ5KNjmMknYAhHqy3LMxZaYrouqCFHAa8decDJ8S4WttIuMcG IhnA== X-Gm-Message-State: AOAM532XxP7sFdpLyDyop+YvgYSXZ0qydbNWFi0fN1qtARW4KR2qPE5T DA8NkrU9SWu4zh9z6AehSmM= X-Google-Smtp-Source: ABdhPJxwBLia0GULiakrQ/ChbOUlE5Y7VdEixYIKRKbmd5BUsUIAgrVrusZYIWrKZfjHhsy2cqSD6Q== X-Received: by 2002:a05:6e02:20c5:: with SMTP id 5mr28877967ilq.14.1620778707477; Tue, 11 May 2021 17:18:27 -0700 (PDT) From: Connor Davis To: Greg Kroah-Hartman Cc: Connor Davis , Lee Jones , Jann Horn , Chunfeng Yun , xen-devel@lists.xenproject.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] usb: early: Avoid using DbC if already enabled Date: Tue, 11 May 2021 18:18:19 -0600 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" 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 =3D (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 =3D NULL; + xdbc.xhci_base =3D NULL; + xdbc.xhci_length =3D 0; + + return -ENODEV; + } + return 0; } -- 2.31.1 From nobody Fri Nov 29 22:57:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1620778730; cv=none; d=zohomail.com; s=zohoarc; b=NzSHe4idtBaG4dsj1bZHz3Ni2A1ogvFWHqt6wfamCLCR5lB0f2PkqWX1OKUewmmXBcCJoIknp0Hm94D3dl3qaXltq/nQVt5wboqA3q9XQw7UtjCcEAX4ZhdPLgoGhKN2JP7wQw96PeipcBA+ACURH1SYMZs3ISoreLDRbqbEVvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620778730; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZVffP2AoY7DIGJlRpw6y32EVHjpd/fv+1cj2j/7FT4M=; b=kjmWZYJN2g5ZlrPZcF5AefmnwzRGB0I2Mc3Z8mcO9BCqYJcw0aQ8ZRn3CNTfG5pBGLRi9x5W0rAYp2xWI8WydVdhCXQ4mDHrjQK0UYy4q3loUdhDrtLZVcTlSjqS4AyPfShivNOFENHxLnCcSZsqsluhp7FiQkT0Z115UP2HMNI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1620778730291899.8211297864377; Tue, 11 May 2021 17:18:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.126089.237367 (Exim 4.92) (envelope-from ) id 1lgca9-0001Na-HB; Wed, 12 May 2021 00:18:33 +0000 Received: by outflank-mailman (output) from mailman id 126089.237367; Wed, 12 May 2021 00:18:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgca9-0001NN-Dg; Wed, 12 May 2021 00:18:33 +0000 Received: by outflank-mailman (input) for mailman id 126089; Wed, 12 May 2021 00:18:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgca8-0000kd-1H for xen-devel@lists.xenproject.org; Wed, 12 May 2021 00:18:32 +0000 Received: from mail-il1-x12e.google.com (unknown [2607:f8b0:4864:20::12e]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ae5463af-e05a-42f4-9cba-c489d57f25a0; Wed, 12 May 2021 00:18:31 +0000 (UTC) Received: by mail-il1-x12e.google.com with SMTP id h6so18736306ila.7 for ; Tue, 11 May 2021 17:18:31 -0700 (PDT) Received: from localhost.localdomain (142-79-211-230.starry-inc.net. [142.79.211.230]) by smtp.gmail.com with ESMTPSA id v4sm8241490iol.3.2021.05.11.17.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 17:18:29 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ae5463af-e05a-42f4-9cba-c489d57f25a0 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=ZVffP2AoY7DIGJlRpw6y32EVHjpd/fv+1cj2j/7FT4M=; b=HKnovley9S67BXN2eY+XSVLSSfFtLlQ2kmN/4O2HSj64YCc9GppYzEoOrRHHfVAP1J op9/qFDgSnmNQF7nldySt19Ck/ztvAFJ6asAk7LlNvKUjYpm3cxnJwCx7KhTqMgBAhmR 1miUzwF4xB96xw+Vz0cMh4OX2JIlMJ+ufYnYZPt0bs/0GIqb4Co9/FvPEZHjq0lL+uyH 7U3ZRyoftT1gtjpnIhcVjYD3xlF3jJVWxk1LSuTxfQORCUjyi3/7t9WLCssbc2fObi3C Ypz+I4182NPMJ9Awk/vb3fDmosz2pjnGIuXCdvirAz8HKUTvzI/iYCdH93CH5EPbwBT9 nIkw== 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=ZVffP2AoY7DIGJlRpw6y32EVHjpd/fv+1cj2j/7FT4M=; b=h727M7gj41KqS4mDMPIwOojFsdp5Z3S2Py8SFUMdE6fx4qDdLRjs8kO8IFVRST9NL3 Kae8ZaQa4lmbMtcW/craJOekvHF3UphFjEHl9swt55eTt4VDdBZQ17cyzatAw6lqsZaU /sSd0vKpJTlf1mSFMhy9NlclFLt9JhTcfue3UsBIkkCIU0YxBMLqH59/2wJLfntqCK5m QOOx+UNRbMDjbC01b2hoU6xE5SGWOCIcTIfJI4YukzCoMC0tv41Ouq0j/cBQKkl95y8/ cdN6CsP77Pj9rDEJVrRyGdkVBtksZipHSNVLaIcCj5lJvCRddTV/uYOPVMLx5yYE3ZMA eFtw== X-Gm-Message-State: AOAM530zvw34vsZtMQRvIwLHEi0e7JQSbGqzW5gtmnDTmniN51GtHNbd EWsDC+875qoNeIQgLm4tFM/Oi272b3EVKQ== X-Google-Smtp-Source: ABdhPJyGiX9C7qlPKoElf5vX50Gg7NyKG09/3UfVmVSHmJj770UiKDP6hzvjmA6DUZd/5xzM6KdSFg== X-Received: by 2002:a05:6e02:1b06:: with SMTP id i6mr14387567ilv.139.1620778709944; Tue, 11 May 2021 17:18:29 -0700 (PDT) From: Connor Davis To: Boris Ostrovsky , Juergen Gross , Stefano Stabellini Cc: Connor Davis , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] xen: Export dbgp functions when CONFIG_XEN_DOM0 is enabled Date: Tue, 11 May 2021 18:18:20 -0600 Message-Id: <291659390aff63df7c071367ad4932bf41e11aef.1620776161.git.connojdavis@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Export xen_dbgp_reset_prep and xen_dbgp_external_startup when CONFIG_XEN_DOM0 is defined. This allows use of these symbols even if CONFIG_EARLY_PRINK_DBGP is defined. Signed-off-by: Connor Davis Acked-by: Juergen Gross --- drivers/xen/dbgp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/dbgp.c b/drivers/xen/dbgp.c index cfb5de31d860..fef32dd1a5dc 100644 --- a/drivers/xen/dbgp.c +++ b/drivers/xen/dbgp.c @@ -44,7 +44,7 @@ int xen_dbgp_external_startup(struct usb_hcd *hcd) return xen_dbgp_op(hcd, PHYSDEVOP_DBGP_RESET_DONE); } -#ifndef CONFIG_EARLY_PRINTK_DBGP +#if defined(CONFIG_XEN_DOM0) || !defined(CONFIG_EARLY_PRINTK_DBGP) #include EXPORT_SYMBOL_GPL(xen_dbgp_reset_prep); EXPORT_SYMBOL_GPL(xen_dbgp_external_startup); -- 2.31.1 From nobody Fri Nov 29 22:57:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1620778732; cv=none; d=zohomail.com; s=zohoarc; b=hxzjTQCWICUxCWsMjTo3ZTm8lAkNZnqMAOavRrABv3t/SHK8XYbs+YAELGfGQXaI9ElDZEZK4pOCdb+6ovqVlMQnkoM117zZshir/BiKaqz+veer9b7U0gRYDrkscTc4ry+MnENHQ9528C2MQ+46nxpXiJAUoE/BIaDLo3F9aBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620778732; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ITi3r5Sk3xjHS5bejnw6zCgTDqxpb5q4mGkKmUxd1DM=; b=TNnnJC+pSQVJVmK55GLW/bn2fZkOUUMzTGy9/nvvLBVExYy/TYD2IunLAPnOYvr7lorVCktC6gXdMrwuDgO2fHUAKqqSbzl5Wv6AEOM4ZndZrd9TF5qSam//qmW3iGuHHbevH1yu15tATAntqunSDub477IMcWo4BDVxkkw3geI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1620778732420349.58204742022383; Tue, 11 May 2021 17:18:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.126090.237379 (Exim 4.92) (envelope-from ) id 1lgcaA-0001fi-Rk; Wed, 12 May 2021 00:18:34 +0000 Received: by outflank-mailman (output) from mailman id 126090.237379; Wed, 12 May 2021 00:18:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgcaA-0001fa-OB; Wed, 12 May 2021 00:18:34 +0000 Received: by outflank-mailman (input) for mailman id 126090; Wed, 12 May 2021 00:18:33 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgca9-0000kd-CV for xen-devel@lists.xenproject.org; Wed, 12 May 2021 00:18:33 +0000 Received: from mail-il1-x12c.google.com (unknown [2607:f8b0:4864:20::12c]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bf0ad1d5-2bdd-4ddb-b008-1f072f66397b; Wed, 12 May 2021 00:18:32 +0000 (UTC) Received: by mail-il1-x12c.google.com with SMTP id e14so18705257ils.12 for ; Tue, 11 May 2021 17:18:32 -0700 (PDT) Received: from localhost.localdomain (142-79-211-230.starry-inc.net. [142.79.211.230]) by smtp.gmail.com with ESMTPSA id v4sm8241490iol.3.2021.05.11.17.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 17:18:31 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bf0ad1d5-2bdd-4ddb-b008-1f072f66397b 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=ITi3r5Sk3xjHS5bejnw6zCgTDqxpb5q4mGkKmUxd1DM=; b=vWbP78NMwE3T8JmfFp4s36sK/+i7v7xLPMGWtj+2kA8AvoYHmt83INZDx0up4Xd4QC B3aSpbLVmMk34VolopZeFugY28THv0nD4MH4zjjkay7gn4t8WQozRW3ZDElU8059RaeZ oX28+d32WYp/Chaada+JSWidliqK190G+TceqHHRVg81DujDoVtt5oKaTcBcX59GUtxz L9KflBGAPxBqEhm2G4h+hQEVK53HBzB+baoOD5LhmtgcPvvtnCcEYq6bd4m6ThV0fb/K jofnYt2/6Uf/dZ7NEAREsLc75dUYxip4E1tSaWAuusXmya/hiVvLE3kom4tFcAvWk+Kd blUg== 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=ITi3r5Sk3xjHS5bejnw6zCgTDqxpb5q4mGkKmUxd1DM=; b=WSiUx1oNZYJfFybrihMdfYUBGGRhHsAfv8Cjifen4GIEbros+OnGas/QQuNw7wyvuy s4AUTSZypjVAkrB+4iTUQOfqcM6YIYfJYqNTclduRpyYft3vtIeUGThiM1LVhpMNWDdT M8CknEjO1BnFuQpfLUkx9VIUJ4xv6boljtRnORQdPnvRoN2Xx5Yx8dW1t7f+rgNRwv+g PlDjEecRVSpuAMqKnadoBxFBc1oOZXcLMlRqz0c9zhfvsT/5H6G2UijQxg0zUypiMMdL jLyxatKiyH15uGYZHoTwIhx2shkisl6iMpVyS9WN1+7xoV9ki+XZGZasbjz71we1/rip EoGg== X-Gm-Message-State: AOAM533IaQQCGfJD69bRXFnbNSZutDguksEBYozxsTDX4nemQ/o/hVIB xDAJbkltYtCiA+Ug6kIzaHM= X-Google-Smtp-Source: ABdhPJzAnRBOne/bDfCqTIq6WlGLh8r+N1lZieC4W5kBCqqf/2oSXz+QMjlGKV7hfOzzVbYvZm7tQg== X-Received: by 2002:a92:c5c1:: with SMTP id s1mr29521516ilt.295.1620778711693; Tue, 11 May 2021 17:18:31 -0700 (PDT) From: Connor Davis To: Greg Kroah-Hartman Cc: Connor Davis , Mathias Nyman , xen-devel@lists.xenproject.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] usb: xhci: Notify xen when DbC is unsafe to use Date: Tue, 11 May 2021 18:18:21 -0600 Message-Id: <2af7e7b8d569e94ab9c48039040ca69a8d52c89d.1620776161.git.connojdavis@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" When running as a dom0 guest on Xen, check if the USB3 debug capability is enabled before xHCI reset, suspend, and resume. If it is, call xen_dbgp_reset_prep() to notify Xen that it is unsafe to touch MMIO registers until the next xen_dbgp_external_startup(). This notification allows Xen to avoid undefined behavior resulting from MMIO access when the host controller's CNR bit is set or when the device transitions to D3hot. Signed-off-by: Connor Davis --- drivers/usb/host/xhci-dbgcap.h | 6 ++++ drivers/usb/host/xhci.c | 57 ++++++++++++++++++++++++++++++++++ drivers/usb/host/xhci.h | 1 + 3 files changed, 64 insertions(+) diff --git a/drivers/usb/host/xhci-dbgcap.h b/drivers/usb/host/xhci-dbgcap.h index c70b78d504eb..24784b82a840 100644 --- a/drivers/usb/host/xhci-dbgcap.h +++ b/drivers/usb/host/xhci-dbgcap.h @@ -227,4 +227,10 @@ static inline int xhci_dbc_resume(struct xhci_hcd *xhc= i) return 0; } #endif /* CONFIG_USB_XHCI_DBGCAP */ + +#ifdef CONFIG_XEN_DOM0 +int xen_dbgp_reset_prep(struct usb_hcd *hcd); +int xen_dbgp_external_startup(struct usb_hcd *hcd); +#endif /* CONFIG_XEN_DOM0 */ + #endif /* __LINUX_XHCI_DBGCAP_H */ diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ca9385d22f68..afe44169183f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -37,6 +37,57 @@ static unsigned long long quirks; module_param(quirks, ullong, S_IRUGO); MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default"); +#ifdef CONFIG_XEN_DOM0 +#include + +static void xhci_dbc_external_reset_prep(struct xhci_hcd *xhci) +{ + struct dbc_regs __iomem *regs; + void __iomem *base; + int dbc_cap; + + if (!xen_initial_domain()) + return; + + base =3D &xhci->cap_regs->hc_capbase; + dbc_cap =3D xhci_find_next_ext_cap(base, 0, XHCI_EXT_CAPS_DEBUG); + + if (!dbc_cap) + return; + + xhci->external_dbc =3D 0; + regs =3D base + dbc_cap; + + if (readl(®s->control) & DBC_CTRL_DBC_ENABLE) { + if (xen_dbgp_reset_prep(xhci_to_hcd(xhci))) + xhci_dbg_trace(xhci, trace_xhci_dbg_init, + "// Failed to reset external DBC"); + else { + xhci->external_dbc =3D 1; + xhci_dbg_trace(xhci, trace_xhci_dbg_init, + "// Completed reset of external DBC"); + } + } +} + +static void xhci_dbc_external_reset_done(struct xhci_hcd *xhci) +{ + if (!xen_initial_domain() || !xhci->external_dbc) + return; + + if (xen_dbgp_external_startup(xhci_to_hcd(xhci))) + xhci->external_dbc =3D 0; +} +#else +static void xhci_dbc_external_reset_prep(struct xhci_hcd *xhci) +{ +} + +static void xhci_dbc_external_reset_done(struct xhci_hcd *xhci) +{ +} +#endif + static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) { struct xhci_segment *seg =3D ring->first_seg; @@ -180,6 +231,8 @@ int xhci_reset(struct xhci_hcd *xhci) return 0; } + xhci_dbc_external_reset_prep(xhci); + xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Reset the HC"); command =3D readl(&xhci->op_regs->command); command |=3D CMD_RESET; @@ -211,6 +264,8 @@ int xhci_reset(struct xhci_hcd *xhci) */ ret =3D xhci_handshake(&xhci->op_regs->status, STS_CNR, 0, 10 * 1000 * 1000); + if (!ret) + xhci_dbc_external_reset_done(xhci); xhci->usb2_rhub.bus_state.port_c_suspend =3D 0; xhci->usb2_rhub.bus_state.suspended_ports =3D 0; @@ -991,6 +1046,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) return 0; xhci_dbc_suspend(xhci); + xhci_dbc_external_reset_prep(xhci); /* Don't poll the roothubs on bus suspend. */ xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); @@ -1225,6 +1281,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernate= d) spin_unlock_irq(&xhci->lock); xhci_dbc_resume(xhci); + xhci_dbc_external_reset_done(xhci); done: if (retval =3D=3D 0) { diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 2595a8f057c4..61d8efc9eef2 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1920,6 +1920,7 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; + int external_dbc; /* platform-specific data -- must come last */ unsigned long priv[] __aligned(sizeof(s64)); }; -- 2.31.1