[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/31] hw/i386/amd_iommu: Set PCI static/const fields via PCIDevic
From: |
Michael S. Tsirkin |
Subject: |
[PULL 13/31] hw/i386/amd_iommu: Set PCI static/const fields via PCIDeviceClass |
Date: |
Tue, 25 Apr 2023 03:45:31 -0400 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
---
hw/i386/amd_iommu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 9f6622e11f..8e4ce63f8e 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";
--
MST
- [PULL 05/31] vhost: Drop unused eventfd_add|del hooks, (continued)
- [PULL 05/31] vhost: Drop unused eventfd_add|del hooks, Michael S. Tsirkin, 2023/04/25
- [PULL 04/31] meson_options.txt: Enable qom-cast-debug by default again, Michael S. Tsirkin, 2023/04/25
- [PULL 06/31] docs: vhost-user: Define memory region separately, Michael S. Tsirkin, 2023/04/25
- [PULL 08/31] virtio-balloon: optimize the virtio-balloon on the ARM platform, Michael S. Tsirkin, 2023/04/25
- [PULL 07/31] docs: vhost-user: Add Xen specific memory mapping support, Michael S. Tsirkin, 2023/04/25
- [PULL 02/31] Add my old and new work email mapping and use work email to support biosbits, Michael S. Tsirkin, 2023/04/25
- [PULL 09/31] MAINTAINERS: Mark AMD-Vi emulation as orphan, Michael S. Tsirkin, 2023/04/25
- [PULL 11/31] hw/i386/amd_iommu: Remove intermediate AMDVIState::devid field, Michael S. Tsirkin, 2023/04/25
- [PULL 10/31] hw/i386/amd_iommu: Explicit use of AMDVI_BASE_ADDR in amdvi_init, Michael S. Tsirkin, 2023/04/25
- [PULL 12/31] hw/i386/amd_iommu: Move capab_offset from AMDVIState to AMDVIPCIState, Michael S. Tsirkin, 2023/04/25
- [PULL 13/31] hw/i386/amd_iommu: Set PCI static/const fields via PCIDeviceClass,
Michael S. Tsirkin <=
- [PULL 14/31] hw/i386/amd_iommu: Factor amdvi_pci_realize out of amdvi_sysbus_realize, Michael S. Tsirkin, 2023/04/25
- [PULL 15/31] hw: Add compat machines for 8.1, Michael S. Tsirkin, 2023/04/25
- [PULL 16/31] pci: avoid accessing slot_reserved_mask directly outside of pci.c, Michael S. Tsirkin, 2023/04/25
- [PULL 17/31] vhost-user-blk-server: notify client about disk resize, Michael S. Tsirkin, 2023/04/25
- [PULL 18/31] Add my old and new work email mapping and use work email to support acpi, Michael S. Tsirkin, 2023/04/25
- [PULL 20/31] tests: bios-tables-test: replace memset with initializer, Michael S. Tsirkin, 2023/04/25
- [PULL 19/31] hw/acpi: limit warning on acpi table size to pc machines older than version 2.3, Michael S. Tsirkin, 2023/04/25
- [PULL 23/31] intel_iommu: refine iotlb hash calculation, Michael S. Tsirkin, 2023/04/25
- [PULL 25/31] virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX, Michael S. Tsirkin, 2023/04/25