Re: [PATCH 06/32] s390/airq: allow for airq structure that uses an input vector

Christian Borntraeger
2021-12-08T12:59:27Z

Am 07.12.21 um 21:57 schrieb Matthew Rosato:
> When doing device passthrough where interrupts are being forwarded
> from host to guest, we wish to use a pinned section of guest memory
> as the vector (the same memory used by the guest as the vector).
>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
> arch/s390/include/asm/airq.h | 4 +++-
> arch/s390/pci/pci_irq.c | 8 ++++----
> drivers/s390/cio/airq.c | 10 +++++++---
> drivers/s390/virtio/virtio_ccw.c | 2 +-
> 4 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/arch/s390/include/asm/airq.h b/arch/s390/include/asm/airq.h
> index 7918a7d09028..e82e5626e139 100644
> --- a/arch/s390/include/asm/airq.h
> +++ b/arch/s390/include/asm/airq.h
> @@ -47,8 +47,10 @@ struct airq_iv {
> #define AIRQ_IV_PTR 4 /* Allocate the ptr array */
> #define AIRQ_IV_DATA 8 /* Allocate the data array */
> #define AIRQ_IV_CACHELINE 16 /* Cacheline alignment for the vector */
> +#define AIRQ_IV_GUESTVEC 32 /* Vector is a pinned guest page */
>
> -struct airq_iv *airq_iv_create(unsigned long bits, unsigned long flags);
> +struct airq_iv *airq_iv_create(unsigned long bits, unsigned long flags,
> + unsigned long *vec);
> void airq_iv_release(struct airq_iv *iv);
> unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num);
> void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num);
> diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c
> index 880bcd73f11a..dfd4f3276a6d 100644
> --- a/arch/s390/pci/pci_irq.c
> +++ b/arch/s390/pci/pci_irq.c
> @@ -296,7 +296,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
> zdev->aisb = bit;
>
> /* Create adapter interrupt vector */
> - zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK);
> + zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK, 0);
> if (!zdev->aibv)
> return -ENOMEM;
>
> @@ -421,7 +421,7 @@ static int __init zpci_directed_irq_init(void)
> union zpci_sic_iib iib = {{0}};
> unsigned int cpu;
>
> - zpci_sbv = airq_iv_create(num_possible_cpus(), 0);
> + zpci_sbv = airq_iv_create(num_possible_cpus(), 0, 0);

For a pointer use NULL? Also in other places. With the indentation fix this looks sane.