From nobody Fri Jan 21 02:27:07 2022 X-Original-To: dev-commits-src-branches@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 5CEEA19692C2; Fri, 21 Jan 2022 02:27:16 +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 4Jg3DY3RhFz4p62; Fri, 21 Jan 2022 02:27:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642732032; 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=ayHqISWDTIlh73kknmEdnqui2Nfs3+xEoaOo0I89o8Y=; b=SNOHZ81N4aCB8za1ic+o6/ACFUdz1ynX0Lm2d7Z6PoIcSxGwjJNdyXVlTHnN8NJlq4kS+8 FXuklS5Rwo2pEcyp3O99xtlkl4be1TCEBbSRWlN+/zy7UObZ2D5e5J0C1W/8z2JEZ4UWtZ HVE9AeRXhEfXlkRWaam0Tlyb19GP4DAIjpqKVS2Z0SVpEp1P98l3JYVN3b6/AE4FatGsMA uO7RnMKzcrvTDCQZ2XZOcMSOhmj1I5RG9nn78IJFEFObeUFMRF3H0ogZpFMtMVOH3OLPlp GZpFwUWPx0teVtLOp9ibL+xc6/H9KrCuyaNnBcKljo3EbjPRH9pq3L0hOWRBsQ== 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 A98C613CB2; Fri, 21 Jan 2022 02:27:07 +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 20L2R7nQ001558; Fri, 21 Jan 2022 02:27:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20L2R7iD001557; Fri, 21 Jan 2022 02:27:07 GMT (envelope-from git) Date: Fri, 21 Jan 2022 02:27:07 GMT Message-Id: <202201210227.20L2R7iD001557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: cc20d7570563 - stable/13 - nvme_ahci: Mark AHCI devices as such in the controller List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc20d7570563d5b7e2f91b07a9f2c8a0241cd061 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642732032; 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=ayHqISWDTIlh73kknmEdnqui2Nfs3+xEoaOo0I89o8Y=; b=kIo2dBulSp8jXtLGAUXManAzh0OXvNBz1zDWBvNk3lXaxpiscoylp6+t31Vbdkj8TAFaEu +pNNwcE1aUZsyM5NLMMsEVZpTZnqTKd2pM1+3Tk9dDeZxSXneV/IJfhaK7lcMDjObA1JGw nFadAA6OkyaCcD2hrvG1P4BhjJnpJ4Sy05I6utpE7XInDw+Q+v/wJY7yEDvNHltO3sTPBH ISAZjCaioBRqo6zJZHEFMga6YaqKtuSmRQi7T6u61uKt0tlCtj1PZK1rbgOuGXfbYwCeA6 lUTOc/QXNNiCgDqxe0DXp8q/1Uq3XeRVUmDJ6XnLwSl/sIKEGY2k9jJ00ZIxJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642732032; a=rsa-sha256; cv=none; b=aqefpa2wwK51662UjRP6nojMhkJMilKZHnxm1HisJfL3rB1ODVEVwchqTRIo9wPW5NgVXl aKiN9tmMNFLjPZMBq/IgnkYlMmYeCKGyzjfcYQ73MJft0mjNcqn63HRCoX3CKJbfKD0Joe yN7LE0Z4Ic1yMaG69zDQ9zJYSYBdjjvPS7PZjsVZpoVuZ1iAdNPnM2iGAAjj7lbID76uMw oE1Z8XCsX5xKFMH2jgYV7Bbjm2BZ5qabO8Mybh1m0DawZvyiK68wxwQQr4dQ5/fhoD8Q+R fxCYcNPNbkHc9p9AN3qHo/IWkR1YEScXNfOzHt7/2o6nq0yEIrZdrQJiyAD+eQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=cc20d7570563d5b7e2f91b07a9f2c8a0241cd061 commit cc20d7570563d5b7e2f91b07a9f2c8a0241cd061 Author: Warner Losh AuthorDate: 2021-12-06 17:23:06 +0000 Commit: Alexander Motin CommitDate: 2022-01-21 02:07:31 +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 (cherry picked from commit 7cf8d63c884c484fee9b287f792549ee15270ae7) --- 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;