nvme-pci: Use single IRQ vector for old Apple models
PATCH 1/2 nvme-pci: Use single IRQ vector for old Apple models
People reported that old Apple machines are not working properly if the non-first IRQ vector is in use.
Set quirk for that models to limit IRQ to use first vector only.
Based on original patch by GitHub user npx001.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -3096,7 +3096,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_NO_DEEPEST_PS | NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, - { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, + { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001), + .driver_data = NVME_QUIRK_SINGLE_VECTOR }, { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) }, { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005), .driver_data = NVME_QUIRK_SINGLE_VECTOR |
Signature · 7 lines
2.25.0 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH 2/2 nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
Like for Intel devices use PCI_VDEVICE() macro to describe Apple devices.
Besides that it's a luck that we got devices enumerated when they are listed after class matching entry. So, move them above and leave class matching entry the last in the ID table.
--- drivers/nvme/host/pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/nvme/host/pci.c +9 -6
@@ -3095,14 +3095,17 @@ static const struct pci_device_id nvme_id_table[] = { { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */ .driver_data =NVME_QUIRK_NO_DEEPEST_PS | NVME_QUIRK_IGNORE_DEV_SUBNQN, }, - { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, - { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001), - .driver_data = NVME_QUIRK_SINGLE_VECTOR }, - { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) }, - { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005), + + /* Apple devices */ + { PCI_VDEVICE(APPLE, 0x2001), + .driver_data = NVME_QUIRK_SINGLE_VECTOR, }, + { PCI_VDEVICE(APPLE, 0x2003), }, + { PCI_VDEVICE(APPLE, 0x2005), .driver_data = NVME_QUIRK_SINGLE_VECTOR |NVME_QUIRK_128_BYTES_SQES | - NVME_QUIRK_SHARED_TAGS }, + NVME_QUIRK_SHARED_TAGS, }, + + { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, { 0, } };MODULE_DEVICE_TABLE (pci, nvme_id_table);
Signature · 7 lines
2.25.0 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Christoph Hellwig
maintainerRe: [PATCH v1 2/2] nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
Quoted 2 lines · Andy Shevchenko
Like for Intel devices use
PCI_VDEVICE()macro to describe Apple devices.
This actually makes the code longer and adds the antipattern of macros that use string pasting on their argument, and this breaking grep-ability badly, so NAK.
Quoted 3 lines
Besides that it's a luck that we got devices enumerated when they are listed after class matching entry. So, move them above and leave class matching entry the last in the ID table.
It isn't by luck. If the Apple devices were using the proper NVMe class ID we'd never hit the apple specific entries, but the actually use a different class code (the nvme one in big endian IIRC). That being said I'm all for having the class match last.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH v1 2/2] nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Andy Shevchenko
Like for Intel devices use
PCI_VDEVICE()macro to describe Apple devices.This actually makes the code longer
I didn't get this. How? The code is for sure shorter.
Quoted 2 lines
and adds the antipattern of macros
that use string pasting on their argument,
Anti-pattern to what? Can you elaborate a bit more? Sounds like I missed some very basic thing.
Quoted 1 line
and this breaking grep-ability > badly, so NAK.
This like a mantra people are telling, but looks like simple they didn't try. What grep issue do you see in this case (I would agree if we talk about device ID, though)?
Are you going to remove PCI_VDEVICE() completely? Are you going to be consistent with the rest in this driver?
This patch (first part of it) is to bring some consistency to this table. I don't see how it may thing worse than they are already.
Quoted 8 lines
Quoted 3 lines
Besides that it's a luck that we got devices enumerated when they are listed after class matching entry. So, move them above and leave class matching entry the last in the ID table.
It isn't by luck. If the Apple devices were using the proper NVMe class ID we'd never hit the apple specific entries, but the actually use a different class code (the nvme one in big endian IIRC). That being said I'm all for having the class match last.
Nobody prevents Apple to fix this and re-use old ID. So, under luck we may consider Apple's negligence to the standards.
Signature · 9 lines
With Best Regards, Andy Shevchenko _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Keith Busch
maintainerRe: [PATCH v1 2/2] nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Andy Shevchenko
Like for Intel devices use
PCI_VDEVICE()macro to describe Apple devices.This actually makes the code longer
I didn't get this. How? The code is for sure shorter.
What metric are we using? The diff stat says longer.
drivers/nvme/host/pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH v1 2/2] nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
Quoted 11 lines · Keith Busch
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Andy Shevchenko
Like for Intel devices use
PCI_VDEVICE()macro to describe Apple devices.This actually makes the code longer
I didn't get this. How? The code is for sure shorter.
What metric are we using? The diff stat says longer.
I actually read *the code*. Blank lines and comments are being added for better grouping.
Since you cut off the patch itself I can't simple point out what exactly has been done.
Quoted 2 lines
drivers/nvme/host/pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
Signature · 9 lines
With Best Regards, Andy Shevchenko _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Keith Busch
maintainerRe: [PATCH v1 2/2] nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Keith Busch
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Andy Shevchenko
Like for Intel devices use
PCI_VDEVICE()macro to describe Apple devices.This actually makes the code longer
I didn't get this. How? The code is for sure shorter.
Quoted 7 lines
Quoted 1 line
What metric are we using? The diff stat says longer.
I actually read *the code*. Blank lines and comments are being added for better grouping.
Since you cut off the patch itself I can't simple point out what exactly has been done.
Well, including it here would be irrelevant to "the code is for sure shorter" when we can empirically measure *that* point. I'm not the one who made this about long vs short in the first place, but if you want to switch the discussion to the content, then great. I personally value clarity over brevity anyway.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Christoph Hellwig
maintainerRe: [PATCH v1 2/2] nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
In reply to Andy ShevchenkoQuoted 3 lines · Andy Shevchenko
Quoted 1 line
This actually makes the code longer
I didn't get this. How? The code is for sure shorter.
Looks at the diffstat.
Quoted 4 lines
Quoted 3 lines
and adds the antipattern of macros
that use string pasting on their argument,
Quoted 8 lines
Anti-pattern to what? Can you elaborate a bit more? Sounds like I missed some very basic thing.
Quoted 1 line
and this breaking grep-ability > badly, so NAK.
This like a mantra people are telling, but looks like simple they didn't try. What grep issue do you see in this case (I would agree if we talk about device ID, though)?
If I want to grep for PCI_VENDOR_ID_APPLE I find the ids in the old code. I won't find them in your new code.
Quoted 2 lines
Are you going to remove
PCI_VDEVICE()completely? Are you going to be consistent with the rest in this driver?
If you care strongly about using the same macro please send a patch to remove it in nvme. I certainly don't want the sane version switched over to it.
Quoted 7 lines
Quoted 4 lines
It isn't by luck. If the Apple devices were using the proper NVMe class ID we'd never hit the apple specific entries, but the actually use a different class code (the nvme one in big endian IIRC). That being said I'm all for having the class match last.
Nobody prevents Apple to fix this and re-use old ID. So, under luck we may consider Apple's negligence to the standards.
I'm just saying the current atch is not by luck. As said in the previous mail I'm fine with moving the class match to the end as it generally is a good idea. I just disagree with the "works by luck" statement for the current entries.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH v1 2/2] nvme-pci: Convert to PCI_VDEVICE() macro for Apple devices
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines · Andy Shevchenko
Quoted 1 line
This actually makes the code longer
I didn't get this. How? The code is for sure shorter.
Looks at the diffstat.
Yes, but let's calculate a real code (not all lines).
In terms of characters it's shorter, in terms of LOCs it's the same. On top few comment / blank lines were added.
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
and adds the antipattern of macros
that use string pasting on their argument,Anti-pattern to what? Can you elaborate a bit more? Sounds like I missed some very basic thing.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
and this breaking grep-ability > badly, so NAK.
This like a mantra people are telling, but looks like simple they didn't try. What grep issue do you see in this case (I would agree if we talk about device ID, though)?
If I want to grep for
PCI_VENDOR_ID_APPLEI find the ids in the old code. I won't find them in your new code.
But it's matter of writing good enough RE, right?
What about, as rough approximation, git grep -n 'PCI_[^,]\+APPLE'?
Quoted 6 lines
Quoted 2 lines
Are you going to remove
PCI_VDEVICE()completely? Are you going to be consistent with the rest in this driver?If you care strongly about using the same macro please send a patch to remove it in nvme. I certainly don't want the sane version switched over to it.
Perhaps in the future, but no guarantees I find a time for that soon.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
It isn't by luck. If the Apple devices were using the proper NVMe class ID we'd never hit the apple specific entries, but the actually use a different class code (the nvme one in big endian IIRC). That being said I'm all for having the class match last.
Quoted 7 lines
Quoted 2 lines
Nobody prevents Apple to fix this and re-use old ID. So, under luck we may consider Apple's negligence to the standards.
I'm just saying the current atch is not by luck. As said in the previous mail I'm fine with moving the class match to the end as it generally is a good idea. I just disagree with the "works by luck" statement for the current entries.
Thanks, I will send a new patch just for that.
Signature · 9 lines
With Best Regards, Andy Shevchenko _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Christoph Hellwig
maintainerQuoted 6 lines · Andy Shevchenko
People reported that old Apple machines are not working properly if the non-first IRQ vector is in use.
Set quirk for that models to limit IRQ to use first vector only.
Based on original patch by GitHub user npx001.
Shouldn't that be a reported by? And do we have a real name / email address?
The patch itself looks fine.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 10 lines · Christoph Hellwig
Quoted 6 lines · Andy Shevchenko
People reported that old Apple machines are not working properly if the non-first IRQ vector is in use.
Set quirk for that models to limit IRQ to use first vector only.
Based on original patch by GitHub user npx001.
Shouldn't that be a reported by? And do we have a real name / email address?
If I would know who is behind that...
I'll post a link to this patch to ask people test / tag it.
Quoted 1 line
The patch itself looks fine.
Thanks for review.
Signature · 9 lines
With Best Regards, Andy Shevchenko _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Thanks, applied for the next 5.6 pull request.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme