Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci
Let's add a new abstract "virtio memory device" type, and use it as parent class of virtio-mem-pci and virtio-pmem-pci. Message-ID: <20230711153445.514112-2-david@redhat.com> Tested-by: Mario Casquero <mcasquer@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com>
- Loading branch information
1 parent
b01fd4b
commit 18129c1
Showing
9 changed files
with
89 additions
and
16 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
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,33 @@ | ||
| /* | ||
| * Abstract virtio based memory device | ||
| * | ||
| * Copyright (C) 2023 Red Hat, Inc. | ||
| * | ||
| * Authors: | ||
| * David Hildenbrand <david@redhat.com> | ||
| * | ||
| * This work is licensed under the terms of the GNU GPL, version 2. | ||
| * See the COPYING file in the top-level directory. | ||
| */ | ||
|
|
||
| #include "qemu/osdep.h" | ||
| #include "hw/virtio/virtio-md-pci.h" | ||
| #include "hw/mem/memory-device.h" | ||
|
|
||
| static const TypeInfo virtio_md_pci_info = { | ||
| .name = TYPE_VIRTIO_MD_PCI, | ||
| .parent = TYPE_VIRTIO_PCI, | ||
| .instance_size = sizeof(VirtIOMDPCI), | ||
| .class_size = sizeof(VirtIOMDPCIClass), | ||
| .abstract = true, | ||
| .interfaces = (InterfaceInfo[]) { | ||
| { TYPE_MEMORY_DEVICE }, | ||
| { } | ||
| }, | ||
| }; | ||
|
|
||
| static void virtio_md_pci_register(void) | ||
| { | ||
| type_register_static(&virtio_md_pci_info); | ||
| } | ||
| type_init(virtio_md_pci_register) |
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
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,35 @@ | ||
| /* | ||
| * Abstract virtio based memory device | ||
| * | ||
| * Copyright (C) 2023 Red Hat, Inc. | ||
| * | ||
| * Authors: | ||
| * David Hildenbrand <david@redhat.com> | ||
| * | ||
| * This work is licensed under the terms of the GNU GPL, version 2. | ||
| * See the COPYING file in the top-level directory. | ||
| */ | ||
|
|
||
| #ifndef HW_VIRTIO_MD_PCI_H | ||
| #define HW_VIRTIO_MD_PCI_H | ||
|
|
||
| #include "hw/virtio/virtio-pci.h" | ||
| #include "qom/object.h" | ||
|
|
||
| /* | ||
| * virtio-md-pci: This extends VirtioPCIProxy. | ||
| */ | ||
| #define TYPE_VIRTIO_MD_PCI "virtio-md-pci" | ||
|
|
||
| OBJECT_DECLARE_TYPE(VirtIOMDPCI, VirtIOMDPCIClass, VIRTIO_MD_PCI) | ||
|
|
||
| struct VirtIOMDPCIClass { | ||
| /* private */ | ||
| VirtioPCIClass parent; | ||
| }; | ||
|
|
||
| struct VirtIOMDPCI { | ||
| VirtIOPCIProxy parent_obj; | ||
| }; | ||
|
|
||
| #endif |