lkml.org 
[lkml]   [2022]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v8 11/22] KVM: s390: pci: add basic kvm_zdev structure
    On Tue, 24 May 2022 14:58:56 -0400
    Matthew Rosato <mjrosato@linux.ibm.com> wrote:
    > diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
    > new file mode 100644
    > index 000000000000..21c2be5c2713
    > --- /dev/null
    > +++ b/arch/s390/kvm/pci.c
    > @@ -0,0 +1,36 @@
    > +// SPDX-License-Identifier: GPL-2.0
    > +/*
    > + * s390 kvm PCI passthrough support
    > + *
    > + * Copyright IBM Corp. 2022
    > + *
    > + * Author(s): Matthew Rosato <mjrosato@linux.ibm.com>
    > + */
    > +
    > +#include <linux/kvm_host.h>
    > +#include <linux/pci.h>
    > +#include "pci.h"
    > +
    > +static int kvm_s390_pci_dev_open(struct zpci_dev *zdev)
    > +{
    > + struct kvm_zdev *kzdev;
    > +
    > + kzdev = kzalloc(sizeof(struct kvm_zdev), GFP_KERNEL);
    > + if (!kzdev)
    > + return -ENOMEM;
    > +
    > + kzdev->zdev = zdev;
    > + zdev->kzdev = kzdev;
    > +
    > + return 0;
    > +}
    > +
    > +static void kvm_s390_pci_dev_release(struct zpci_dev *zdev)
    > +{
    > + struct kvm_zdev *kzdev;
    > +
    > + kzdev = zdev->kzdev;
    > + WARN_ON(kzdev->zdev != zdev);
    > + zdev->kzdev = 0;

    I imagine this should be s/0/NULL/, right? I feel like there was a
    recent similar discussion, but I can't think of any unique search terms
    to sort it out of my inbox. Thanks,

    Alex

    \
     
     \ /
      Last update: 2022-05-25 00:51    [W:4.158 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site