From owner-freebsd-drivers@freebsd.org Thu Aug 17 22:10:00 2017 Return-Path: Delivered-To: freebsd-drivers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D21F9DDABEA for ; Thu, 17 Aug 2017 22:10:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D1C66710A for ; Thu, 17 Aug 2017 22:10:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x234.google.com with SMTP id c74so27652360iod.4 for ; Thu, 17 Aug 2017 15:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=IQxKxNHeCoAOpiWSkwxqvbZuX//HQJKiKC7HCiy8/co=; b=jhsSk2M6qBQ9u4OPMUdCDW9ynNKoFDP6LHLzfAFofBV96VrVlw3uaW2NC0QxLbS5KJ X3UaimS3/WxaUjVxLVFkxKZ0tSec6HqFxB/MFXVrlG4fTC1bFq+FVdiUdUAdk1V56kNF saU7exny0+GWVEsAWuy60DcDgdCbtvqELvdRqjgDsP8IGEaUAVtRqO1OwzPbs8dzgpga sdKhN1AD6cqmYEyS35RBghGwj8WrkQTD8dRe1qYwJWSjkTkiCjTU9UrApmb0a4zD6fxw 0x2ZURVza2SSo3bY1URS7AaEudvAFPqYQ+TQ5Ui7hJhOxM7sxzobu7c6zAq5jOvGwSBb yLeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=IQxKxNHeCoAOpiWSkwxqvbZuX//HQJKiKC7HCiy8/co=; b=HRQeCx7fhN2/rkDsKNF1pkzLhj8d6T6ivNLuBw2yZL6v0CTa4SXX7xO51BDDZsV8t+ qDteV4RtOYwnz49Bu/jOcthVYLPI4zHtclDUftk/E57jYLI98xjghU3ajk384ddR5Vmv pqQ3tCBQofrMwktiiDJKoOYiFITy4AoJqvi12bHWLZO6c7hf48xl3nUaa3s3bb4FiWG8 ED/QssCbJNzhQbnVJ0vFOXMIBObPBBdve5g0HkfOw+OcU0mQR2qEXiPtwxeEqTv3iO8U jfdSd2etU7JbTrmzHsDItdcX6LPmSEAacoSTw2JcVcwA6p+faLccCqyEQKmbStgIOtLx 9UOQ== X-Gm-Message-State: AHYfb5gk6KmS+UuP2KtkXMuatlIGpWWk2eKOVm/82jNs0Ew8yCvrlN/r FcEBaE6qqakSl7dXguKgxQt04CV9vF2I X-Received: by 10.107.3.234 with SMTP id e103mr6403556ioi.57.1503007799934; Thu, 17 Aug 2017 15:09:59 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Thu, 17 Aug 2017 15:09:59 -0700 (PDT) X-Originating-IP: [69.27.219.53] In-Reply-To: References: From: Warner Losh Date: Thu, 17 Aug 2017 16:09:59 -0600 X-Google-Sender-Auth: sxqxDkiuusAb8i0GX5HgomvO2sc Message-ID: Subject: Re: NVMe driver init sequence To: Kinjal Patel Cc: "freebsd-drivers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 22:10:00 -0000 This sounds right to me.... Most BIOSes seem to enable BME=1. Warner On Thu, Aug 17, 2017 at 2:45 PM, Kinjal Patel wrote: > Hi, > > I have a query on NVMe driver init sequence in FreeBSD 10.3(stable). > > The driver init sequence is, > > 1) Enable controller (CC.EN=1) > > 2) Wait for controller ready (CSTS.RDY=1) > > 3) Set PCI bus master enable (BME=1) > > As per NVMe spec, when NVMe controller becomes ready it has to process > command. > > "Enable (EN): When set to '1', then the controller shall process commands > based on Submission Queue Tail doorbell writes" > > And per PCI Express spec when BME is not set, the PCI Express Function is > not allowed to issue any Memory or I/O requests. > "Bus Master Enable - Controls the ability of a PCI Express Endpoint to > issue Memory95 and I/O Read/Write Requests, and > the ability of a Root or Switch Port to forward Memory and I/O Read/Write > Requests in the Upstream direction" > > Enabling controller before setting BME=1 is violation of spec, as > controller has to accept commands but BME is prerequisite for that. > > The Linux device driver init sequence is, > > 1) Set PCI bus master enable (BME=1) > > 2) Enable Controller (CC.EN=1) > > 3) Wait for controller ready (CSTS.RDY=1) > > The FreeBSD NVMe driver sequence should be changed to set BME=1 before > attempting to enable controller. > > > Regards, > Kinjal Patel > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" >