Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-16 Thread Christoph Hellwig
On Tue, Jul 16, 2019 at 10:17:56PM +1000, Benjamin Herrenschmidt wrote: > If we're going to do that, then I can move it back to pci.c and leave > core.c alone then I suppose. Up to you. I'm just doing that for fun, no > beef in that game :-) let me know how you want it. Sounds safest to me.

Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-16 Thread Benjamin Herrenschmidt
On Tue, 2019-07-16 at 14:05 +0200, Christoph Hellwig wrote: > On Tue, Jul 16, 2019 at 08:58:28PM +1000, Benjamin Herrenschmidt wrote: > > The main risk is if existing controllers return crap in SQES and we try > > to then use that crap. The rest should essentially be NOPs. > > > > Maybe I should

Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-16 Thread Christoph Hellwig
On Tue, Jul 16, 2019 at 08:58:28PM +1000, Benjamin Herrenschmidt wrote: > The main risk is if existing controllers return crap in SQES and we try > to then use that crap. The rest should essentially be NOPs. > > Maybe I should add some kind of printk to warn in case we use/detect a > non-standard

Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-16 Thread Benjamin Herrenschmidt
On Tue, 2019-07-16 at 11:33 +0200, Christoph Hellwig wrote: > > >So back to the version > > > you circulated to me in private mail that just sets q->sqes and has a > > > comment that this is magic for The Apple controller. If/when we get > > > standardized large SQE support we'll need to

Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-16 Thread Christoph Hellwig
On Tue, Jul 16, 2019 at 04:21:14PM +1000, Benjamin Herrenschmidt wrote: > > Actually, this doesn't work on a "real" nvme controller, to change CC > > values the controller needs to be disabled. > > Not really. The specs says that MPS, AMD and CSS need to be set before > enabling, but IOCQES and

Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-16 Thread Benjamin Herrenschmidt
On Tue, 2019-07-16 at 08:04 +0200, Christoph Hellwig wrote: > > > > + /* > > +* If our IO queue size isn't the default, update the setting > > +* in CC:IOSQES. > > +*/ > > + if (ctrl->iosqes != NVME_NVM_IOSQES) { > > +

Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-16 Thread Christoph Hellwig
> + /* Use default IOSQES. We'll update it later if needed */ > ctrl->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES; > ctrl->ctrl_config |= NVME_CC_ENABLE; > > @@ -2698,6 +2699,30 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) > ctrl->hmmin =

[PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller

2019-07-15 Thread Benjamin Herrenschmidt
On PCIe based NVME devices, this will retrieve the IO queue entry size from the controller and use the "required" setting. It should always be 6 (64 bytes) by spec. However some controllers such as Apple's are not properly implementing the spec and require the size to be 7 (128 bytes). This