diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-03-13 16:30:30 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-04-21 04:25:52 -0400 |
commit | 7f5a459dc8132bd15c28a0d2af1f0cf844ee19f4 (patch) | |
tree | 9bd8514f0bfe290ce1509ccff40a268f5915cc38 /hw | |
parent | ae097d8fbd405011afc5c35c7f95a90066a97262 (diff) | |
download | qemu-7f5a459dc8132bd15c28a0d2af1f0cf844ee19f4.zip qemu-7f5a459dc8132bd15c28a0d2af1f0cf844ee19f4.tar.gz qemu-7f5a459dc8132bd15c28a0d2af1f0cf844ee19f4.tar.bz2 |
hw/i386/amd_iommu: Set PCI static/const fields via PCIDeviceClass
Set PCI static/const fields once in amdvi_pci_class_init.
They will be propagated via DeviceClassRealize handler via
pci_qdev_realize() -> do_pci_register_device() -> pci_config_set*().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230313153031.86107-6-philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/i386/amd_iommu.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 9f6622e..8e4ce63 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1511,9 +1511,7 @@ static void amdvi_init(AMDVIState *s) amdvi_set_quad(s, AMDVI_MMIO_STATUS, 0, 0x98, 0x67); /* reset device ident */ - pci_config_set_vendor_id(s->pci.dev.config, PCI_VENDOR_ID_AMD); pci_config_set_prog_interface(s->pci.dev.config, 00); - pci_config_set_class(s->pci.dev.config, 0x0806); /* reset AMDVI specific capabilities, all r/o */ pci_set_long(s->pci.dev.config + s->pci.capab_offset, AMDVI_CAPAB_FEATURES); @@ -1623,6 +1621,10 @@ static const TypeInfo amdvi_sysbus = { static void amdvi_pci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->vendor_id = PCI_VENDOR_ID_AMD; + k->class_id = 0x0806; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->desc = "AMD IOMMU (AMD-Vi) DMA Remapping device"; |