summaryrefslogtreecommitdiffstats
path: root/meta-agl-jailhouse/recipes-kernel/linux/linux/0023-ivshmem-net-Switch-to-pci_alloc_irq_vectors.patch
diff options
context:
space:
mode:
authorJakub Luzny <jakub@luzny.cz>2020-07-19 17:00:08 +0200
committerJakub Luzny <jakub@luzny.cz>2020-07-24 12:46:57 +0200
commit3f6d193683449a323a3f1d689540ab697d3d7980 (patch)
tree093ad36c5bf3f031d469a635d0f2190a57c176e0 /meta-agl-jailhouse/recipes-kernel/linux/linux/0023-ivshmem-net-Switch-to-pci_alloc_irq_vectors.patch
parentc6889de97c1af6baa7ee8006aa75da170c9bd407 (diff)
Add layer to support Jailhouse hypervisorjellyfish_9.99.2jellyfish/9.99.29.99.2
Jailhouse is a partitioning hypervisor based on Linux. It is able to run bare-metal applications or (adapted) operating systems besides Linux. For this purpose, it configures CPU and device virtualization features of the hardware platform in a way that none of these domains, called "cells" here, can interfere with each other in an unacceptable way. This layer adds the Jailhouse package into AGL and also appends the BSPs to allow it to run. Currently, Raspberry Pi 4 and QEMU x86-64 targets are supported. To enable Jailhouse and include it in the image, the AGL feature agl-jailhouse must be enabled. Bug-AGL: SPEC-3507 Signed-off-by: Jakub Luzny <jakub@luzny.cz> Change-Id: I0fbc0b5d931c85d6f22b0222da8c2b106c4115e1
Diffstat (limited to 'meta-agl-jailhouse/recipes-kernel/linux/linux/0023-ivshmem-net-Switch-to-pci_alloc_irq_vectors.patch')
-rw-r--r--meta-agl-jailhouse/recipes-kernel/linux/linux/0023-ivshmem-net-Switch-to-pci_alloc_irq_vectors.patch146
1 files changed, 146 insertions, 0 deletions
diff --git a/meta-agl-jailhouse/recipes-kernel/linux/linux/0023-ivshmem-net-Switch-to-pci_alloc_irq_vectors.patch b/meta-agl-jailhouse/recipes-kernel/linux/linux/0023-ivshmem-net-Switch-to-pci_alloc_irq_vectors.patch
new file mode 100644
index 00000000..fcc2cac3
--- /dev/null
+++ b/meta-agl-jailhouse/recipes-kernel/linux/linux/0023-ivshmem-net-Switch-to-pci_alloc_irq_vectors.patch
@@ -0,0 +1,146 @@
+From 77920ddb91fa49f7085875d29dd2a2c7e783af3a Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <jan.kiszka@siemens.com>
+Date: Tue, 23 May 2017 17:41:00 +0200
+Subject: [PATCH 23/32] ivshmem-net: Switch to pci_alloc_irq_vectors
+
+Required by 4.12, and it also simplifies our code. Needs to be folded
+into the initial patch eventually.
+
+Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
+---
+ drivers/net/ivshmem-net.c | 66 ++++++++++++++++++++---------------------------
+ 1 file changed, 28 insertions(+), 38 deletions(-)
+
+diff --git a/drivers/net/ivshmem-net.c b/drivers/net/ivshmem-net.c
+index 0e770ca293a4..fd7d78b84576 100644
+--- a/drivers/net/ivshmem-net.c
++++ b/drivers/net/ivshmem-net.c
+@@ -114,8 +114,6 @@ struct ivshm_net {
+ u32 peer_id;
+
+ struct pci_dev *pdev;
+- struct msix_entry msix;
+- bool using_msix;
+ };
+
+ static void *ivshm_net_desc_data(struct ivshm_net *in,
+@@ -793,22 +791,21 @@ static int ivshm_net_probe(struct pci_dev *pdev,
+ struct ivshmem_regs __iomem *regs;
+ resource_size_t shmaddr;
+ resource_size_t shmlen;
+- int interrupt;
+ char *device_name;
+ void *shm;
+ u32 ivpos;
+- int err;
++ int ret;
+
+- err = pcim_enable_device(pdev);
+- if (err) {
+- dev_err(&pdev->dev, "pci_enable_device: %d\n", err);
+- return err;
++ ret = pcim_enable_device(pdev);
++ if (ret) {
++ dev_err(&pdev->dev, "pci_enable_device: %d\n", ret);
++ return ret;
+ }
+
+- err = pcim_iomap_regions(pdev, BIT(0), DRV_NAME);
+- if (err) {
+- dev_err(&pdev->dev, "pcim_iomap_regions: %d\n", err);
+- return err;
++ ret = pcim_iomap_regions(pdev, BIT(0), DRV_NAME);
++ if (ret) {
++ dev_err(&pdev->dev, "pcim_iomap_regions: %d\n", ret);
++ return ret;
+ }
+
+ regs = pcim_iomap_table(pdev)[0];
+@@ -869,8 +866,8 @@ static int ivshm_net_probe(struct pci_dev *pdev,
+ spin_lock_init(&in->tx_free_lock);
+ spin_lock_init(&in->tx_clean_lock);
+
+- err = ivshm_net_calc_qsize(ndev);
+- if (err)
++ ret = ivshm_net_calc_qsize(ndev);
++ if (ret)
+ goto err_free;
+
+ in->state_wq = alloc_ordered_workqueue(device_name, 0);
+@@ -889,25 +886,21 @@ static int ivshm_net_probe(struct pci_dev *pdev,
+ netif_carrier_off(ndev);
+ netif_napi_add(ndev, &in->napi, ivshm_net_poll, NAPI_POLL_WEIGHT);
+
+- err = register_netdev(ndev);
+- if (err)
++ ret = register_netdev(ndev);
++ if (ret)
+ goto err_wq;
+
+- err = pci_enable_msix(pdev, &in->msix, 1);
+- if (!err) {
+- interrupt = in->msix.vector;
+- in->using_msix = true;
+- } else {
+- interrupt = pdev->irq;
+- in->using_msix = false;
+- }
++ ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_LEGACY | PCI_IRQ_MSIX);
++ if (ret < 0)
++ goto err_alloc_irq;
+
+- err = request_irq(interrupt, ivshm_net_int, 0, device_name, ndev);
+- if (err)
+- goto err_int;
++ ret = request_irq(pci_irq_vector(pdev, 0), ivshm_net_int, 0,
++ device_name, ndev);
++ if (ret)
++ goto err_request_irq;
+
+ pci_set_master(pdev);
+- if (!in->using_msix)
++ if (!pdev->msix_enabled)
+ writel(IVSHMEM_INTX_ENABLE, &in->ivshm_regs->intxctrl);
+
+ writel(IVSHM_NET_STATE_RESET, &in->ivshm_regs->lstate);
+@@ -915,16 +908,16 @@ static int ivshm_net_probe(struct pci_dev *pdev,
+
+ return 0;
+
+-err_int:
+- if (in->using_msix)
+- pci_disable_msix(pdev);
++err_request_irq:
++ pci_free_irq_vectors(pdev);
++err_alloc_irq:
+ unregister_netdev(ndev);
+ err_wq:
+ destroy_workqueue(in->state_wq);
+ err_free:
+ free_netdev(ndev);
+
+- return err;
++ return ret;
+ }
+
+ static void ivshm_net_remove(struct pci_dev *pdev)
+@@ -934,13 +927,10 @@ static void ivshm_net_remove(struct pci_dev *pdev)
+
+ writel(IVSHM_NET_STATE_RESET, &in->ivshm_regs->lstate);
+
+- if (in->using_msix) {
+- free_irq(in->msix.vector, ndev);
+- pci_disable_msix(pdev);
+- } else {
++ if (!pdev->msix_enabled)
+ writel(0, &in->ivshm_regs->intxctrl);
+- free_irq(pdev->irq, ndev);
+- }
++ free_irq(pci_irq_vector(pdev, 0), ndev);
++ pci_free_irq_vectors(pdev);
+
+ unregister_netdev(ndev);
+ cancel_work_sync(&in->state_work);
+--
+2.11.0
+