From nobody Mon Dec 06 17:25:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 91A6818C1E78; Mon, 6 Dec 2021 17:25:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J79Lb129Hz3Q8g; Mon, 6 Dec 2021 17:25:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F162D7ED7; Mon, 6 Dec 2021 17:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B6HPggE055624; Mon, 6 Dec 2021 17:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6HPgSA055623; Mon, 6 Dec 2021 17:25:42 GMT (envelope-from git) Date: Mon, 6 Dec 2021 17:25:42 GMT Message-Id: <202112061725.1B6HPgSA055623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7cf8d63c884c - main - nvme_ahci: Mark AHCI devices as such in the controller List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cf8d63c884c484fee9b287f792549ee15270ae7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638811543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v1Y9xpQtVUkIkM+leERDnP0RzS2ad0Gfj8km7zzzZWk=; b=neLz/0FDyKVz1jtWa3wgcYKEZkHxI0zxF3+PR2N3dYpxfbdJOamFkpTVbdxlWa+bBAuuuD 8vn/JLKR00SlxZ1Rc1PHgXAiq7z7ncTJy3sa/pivWIq4l8SP41dFF4Upqt+n7yOcjXfbSx WmGZJ9muaarKKFcjJGvF5uSZBH1wu3980ICS25kOLOjI9k5Tb8eZYdog/s+wdb0KI5XPsG yqcbP26Ld70Oz77Kj6xWoAwX7jFpiqU5QL8tqTPOLHyYPmzfYHCplFTghMPdBXcURG+PWn h+C5U+Buj22tlM8XS/nHXmgSGy40QMa7YP9QaGEdVir1bJXIMHs9Auybs97npw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638811543; a=rsa-sha256; cv=none; b=qdrRy3vWwQwT6hGCmI9IdqCPBcb6bk0SRIsy7u3oNeUtevsJAhm4wNQYlu2sgVPmt6NC3G t4fPs9SjXN6Pzi6kevJSkVDjnaRMcXu/3ZybYvweeiLg1HGHkbq1d15hf8datPbsynejiW WdyjJ2oNurX0ZVUxTO2tTrpgHB9zIFoWF3+3h2UdUKDJiDOrefQTdFvYfum3GNBX4LeLmR X4X58RGRUaRzpPayif17ar4MU6qBTG9TVXmTHPtbbZ0cm8ME/a+3NlcDnwWXhu4wthQ92R gsYh5tGxpflail9nQI391UJeQzA+czkufKBj370380N2nnA2iR3ognW7EIfjpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7cf8d63c884c484fee9b287f792549ee15270ae7 commit 7cf8d63c884c484fee9b287f792549ee15270ae7 Author: Warner Losh AuthorDate: 2021-12-06 17:23:06 +0000 Commit: Warner Losh CommitDate: 2021-12-06 17:23:40 +0000 nvme_ahci: Mark AHCI devices as such in the controller Add a quirk to flag AHCI attachment to the controller. This is for any of the strategies for attaching nvme devices as children of the AHCI device for Intel's RAID devices. This also has a side effect of cleaning up resource allocation from failed nvme_attach calls now. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D33285 --- sys/dev/nvme/nvme_ahci.c | 9 ++++++++- sys/dev/nvme/nvme_private.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ahci.c b/sys/dev/nvme/nvme_ahci.c index 8542f6f55246..b2d5813537c3 100644 --- a/sys/dev/nvme/nvme_ahci.c +++ b/sys/dev/nvme/nvme_ahci.c @@ -104,7 +104,14 @@ nvme_ahci_attach(device_t dev) } ctrlr->tag = (void *)0x1; - return nvme_attach(dev); + /* + * We're attached via this funky mechanism. Flag the controller so that + * it avoids things that can't work when we do that, like asking for + * PCI config space entries. + */ + ctrlr->quirks |= QUIRK_AHCI; + + return (nvme_attach(dev)); /* Note: failure frees resources */ bad: if (ctrlr->resource != NULL) { bus_release_resource(dev, SYS_RES_MEMORY, diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 3f89f12cf8fd..c889246f9350 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -241,6 +241,7 @@ struct nvme_controller { #define QUIRK_DELAY_B4_CHK_RDY 1 /* Can't touch MMIO on disable */ #define QUIRK_DISABLE_TIMEOUT 2 /* Disable broken completion timeout feature */ #define QUIRK_INTEL_ALIGNMENT 4 /* Pre NVMe 1.3 performance alignment */ +#define QUIRK_AHCI 8 /* Attached via AHCI redirect */ bus_space_tag_t bus_tag; bus_space_handle_t bus_handle;