nitro_enclaves: set master in the procedure of NE probe
PATCH 1/1 nitro_enclaves: set master in the procedure of NE probe
According the PCI spec:
Bus Master Enable – Controls the ability of a PCI Express Endpoint to issue Memory 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
Set BusMaster to make the driver to be PCI conformant.
--- drivers/virt/nitro_enclaves/ne_pci_dev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/virt/nitro_enclaves/ne_pci_dev.c +2 -0
@@ -480,6 +480,8 @@ static int ne_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto free_ne_pci_dev; } +pci_set_master (pdev); + rc =pci_request_regions_exclusive (pdev,"nitro_enclaves" );if (rc <0 ) {dev_err (&pdev->dev,"Error in pci request regions [rc=%d]\n" , rc);
Signature · 1 line
1.8.3.1
Quoted 7 lines · Longpeng(Mike)
According the PCI spec:
Bus Master Enable – Controls the ability of a PCI Express Endpoint to issue Memory 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 directionSet BusMaster to make the driver to be PCI conformant.
Could update the commit title and message body to reflect more the why and what for the change. One option can be:
nitro_enclaves: Set Bus Master for the NE PCI device
Enable Bus Master for the NE PCI device, according to the PCI spec for submitting memory or I/O requests:
Bus Master Enable ...
Please include the changelog in the commit message for the next revision(s).
+ Greg in CC, as the patches for the Nitro Enclaves kernel driver are first included in the char misc tree, then in the linux next and finally in the mainline.
Quoted 11 lines
Signed-off-by Longpeng(Mike) <[email protected]>--- drivers/virt/nitro_enclaves/ne_pci_dev.c | 2 ++ 1 file changed, 2 insertions(+)drivers/virt/nitro_enclaves/ne_pci_dev.c +0
-0
drivers/virt/nitro_enclaves/ne_pci_dev.c static int ne_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 483
Quoted 4 lines
drivers/virt/nitro_enclaves/ne_pci_dev.c +1
-0@@ -480,6 +480,8 @@ static int ne_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto free_ne_pci_dev; } +pci_set_master (pdev);
I was looking if we need the reverse for this - pci_clear_master() [1] - on the error and remove / shutdown codebase paths, but pci_disable_device() seems to include the bus master disable logic [2][3].
Thanks,
Andra
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pci.c?h=v5.11-rc4#n4312
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pci.c?h=v5.11-rc4#n2104
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pci.c?h=v5.11-rc4#n4242
Quoted 7 lines
drivers/virt/nitro_enclaves/ne_pci_dev.c +1
-1+ rc =pci_request_regions_exclusive (pdev,"nitro_enclaves" );if (rc <0 ) {dev_err (&pdev->dev,"Error in pci request regions [rc=%d]\n" , rc); --1.8.3.1
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Quoted 21 lines · Andra-Irina
Quoted 7 lines · Longpeng(Mike)
According the PCI spec:
Bus Master Enable – Controls the ability of a PCI Express Endpoint to issue Memory 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 directionSet BusMaster to make the driver to be PCI conformant.
Could update the commit title and message body to reflect more the why and what for the change. One option can be:
nitro_enclaves: Set Bus Master for the NE PCI deviceEnable Bus Master for the NE PCI device, according to the PCI spec for submitting memory or I/O requests:
Bus Master Enable ...
Quoted 4 lines
Please include the changelog in the commit message for the next revision(s).
+ Greg in CC, as the patches for the Nitro Enclaves kernel driver are first included in the char misc tree, then in the linux next and finally in the mainline.
Will update the commit message in V2.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Longpeng(Mike) <[email protected]>---
drivers/virt/nitro_enclaves/ne_pci_dev.c| 2 ++1 file changed, 2 insertions(+)drivers/virt/nitro_enclaves/ne_pci_dev.c +0
-0@@ -480,6 +480,8 @@ static int ne_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto free_ne_pci_dev; }
Quoted 4 lines
drivers/virt/nitro_enclaves/ne_pci_dev.c static int ne_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 483
Quoted 1 line
drivers/virt/nitro_enclaves/ne_pci_dev.c +1
-0+ pci_set_master(pdev);I was looking if we need the reverse for this -
pci_clear_master()[1] - on the error and remove / shutdown codebase paths, butpci_disable_device()seems to include the bus master disable logic [2][3].
No need to call pci_clear_master.
Quoted 19 lines
Thanks,
Andra[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pci.c?h=v5.11-rc4#n4312
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pci.c?h=v5.11-rc4#n2104
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pci.c?h=v5.11-rc4#n4242Quoted 7 lines
drivers/virt/nitro_enclaves/ne_pci_dev.c +1
-0+ rc = pci_request_regions_exclusive(pdev, "nitro_enclaves"); if (rc < 0) { dev_err(&pdev->dev, "Error in pci request regions [rc=%d]\n", rc);Signature · 1 line
1.8.3.1Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.