forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KVM: s390: pci: add basic kvm_zdev structure
This structure will be used to carry kvm passthrough information related to zPCI devices. Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Loading branch information
1 parent
7c1e525
commit e6d8c62
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// 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" | ||
|
||
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; | ||
} | ||
EXPORT_SYMBOL_GPL(kvm_s390_pci_dev_open); | ||
|
||
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; | ||
kfree(kzdev); | ||
} | ||
EXPORT_SYMBOL_GPL(kvm_s390_pci_dev_release); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* s390 kvm PCI passthrough support | ||
* | ||
* Copyright IBM Corp. 2022 | ||
* | ||
* Author(s): Matthew Rosato <mjrosato@linux.ibm.com> | ||
*/ | ||
|
||
#ifndef __KVM_S390_PCI_H | ||
#define __KVM_S390_PCI_H | ||
|
||
#include <linux/kvm_host.h> | ||
#include <linux/pci.h> | ||
|
||
struct kvm_zdev { | ||
struct zpci_dev *zdev; | ||
struct kvm *kvm; | ||
}; | ||
|
||
#endif /* __KVM_S390_PCI_H */ |